Playing sound: Switching seamlessly between two or more sounds
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to be able to switch quickly between playing two or more sounds. The purpose is to be able to compare two sounds against each other. It should be possible to select a part of the sound and loop this while switching between sound A and B as shown in the below figure.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/157972/image.png)
When switching from sound A to B (by pressing the B button), sound B should start playing at the current sample - and sound A should stop.
I have been looking at the audioplayer object but this does not support setting the start/stop at specific samples. Any suggestion on how this can be implemented in Matlab?
Thanks,
Jesper Boldt
댓글 수: 0
답변 (1개)
Iain
2014년 3월 5일
I don't know about seamlessly from a GUI.
You can play any duration of sound using "sound". I would be tempted to split the sound into, say, 0.1 second sections, and after playing each 0.1 section, determine what, if any, buttons have been pressed, and continue on with playing the appropriate sound.
If you can define when the switches happen, you can simply construct a sound vector by the normal means, and play it with "sound" or "soundsc"
댓글 수: 2
Rafael Kübler
2019년 7월 18일
Hi,
I'm facing the same problem.
Has there been any other solution since then?
Thanks.
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!