Message Boards Message Boards

1
|
7631 Views
|
6 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Emit sounds over one another?

Posted 6 years ago
POSTED BY: Eric Parfitt
6 Replies

Gadzooks, Vitaliy Kaurov, I know I can start and end notes if I know AHEAD OF TIME when then will start and end and put them in a list. Look think of it this way, what if I were simply trying to play one note, and then when the user hits a key, it plays a note over the first note. How do I do that? I don't think I can, because when the second note plays it stops the first, and I didn't know AHEAD OF TIME that the user would push the button, so I can't just put it all in a list from a table.

Similarly and closer to what I'm doing let's say I'm trying to use the digits of pi to specify start and times. I don't know long the song will go on for so I don't know how many digits I will need ahead of time so I want to play the notes AS the digits are computed, not afterward. Look at my second code example, it uses While, so it goes on forever/indefinitely picking random notes.

In your code, you knew ahead of time what notes would be played. I do not. I'm playing an infinite stream of notes. Does that make sense or not?

P.S. George Woodrow, thanks, I look forward to the eventual new functionality.

POSTED BY: Eric Parfitt

Is this what you need, meaning specifying not duration but the start and end of time interval of a note?

Sound[{SoundNote["C", {0, 2}, "Trumpet"], SoundNote["G", {1, 3}, "Piano"]}]

That was an example from the docs: SoundNote >> Scope >> Timing

http://reference.wolfram.com/language/ref/SoundNote.html

Experimenting with random specs, here are a few ideas:

inst={"Trumpet","Piano","Organ","Violin","Voice"};
Sound[
    Table[
       SoundNote[3RandomInteger[{-5,5}],
       Sort[RandomInteger[{0,9},2]],
       RandomChoice[inst]],
    15]
    ~Join~
    Table[
       SoundNote[3RandomInteger[{-5,5}],
       {#,#+.5}&@RandomReal[{0,9}],
       RandomChoice[inst]],
    15]
]
POSTED BY: Vitaliy Kaurov

At the recent WTC, there was a talk that touched on this. This functionality is apparently coming 'soon', for a suitable definition of 'soon'. You might want to check the video from last year's WTC and this years when they are available.

I guess I should have elaborated on the fact that I'm trying to generate notes continuously. I know how to play songs over one another as long as the notes are specified IN ADVANCE. But my whole problem is that I'm trying to generate an endless stream of notes here. I may be playing for one minute, I may be playing for days, I don't know ahead of time, so I can't, as you say, "put them in a list" because I don't even know how long the list will be.

Believe me I've looked up and down the Sound function, and unless I'm missing something here, I do not see a way to play notes over one another unless, as you say, I put them in a list ahead of time.

I am currently using Mathematica 11.0.0.0

POSTED BY: Eric Parfitt

EmitSound[] is an older function. If you have Version 11 or later, there is a lot of new stuff in Audio. See the documentation and some of the fine tutorials and videos on the website.

Also, you should check the syntax for Emit sound. To play sounds sequentially, you put them in a list, surrounded by {}. The documentation can give you help with rests.

Look at Sound[]. It may give you some clues.

To accomplish your ultimate goal, you will need to use a lot of the functionality in the new Audio Processing.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract