Clear Filters
Clear Filters

Playing sound: Switching seamlessly between two or more sounds

2 views (last 30 days)
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.
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

Answers (1)

Iain
Iain on 5 Mar 2014
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 Comments
Jesper Boldt
Jesper Boldt on 6 Mar 2014
Yes, this might be workaround but it does not seem that - ehhm - elegant. I wonder if any 3rd party tools or code would support my problem, e.g. some java stuff which could be called from Matlab.
I am not able to define when the switching from one sound to the other happens. This is based on the user input.
What I want can be found in (m)any sound processing tool, e.g. audacity, audition, etc. Here you can solo a track a switch between the sound streams.
Thanks,
Jesper
Rafael Kübler
Rafael Kübler on 18 Jul 2019
Hi,
I'm facing the same problem.
Has there been any other solution since then?
Thanks.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!