# Help needed with Wolfrma Mathematica, and relevant discussions about microtonal music.

How to make that sound...
ursellsarn
KVRer
12 posts since 5 Sep, 2020
Are there any nice people on the KVR forum who can help me please with sound and image design in Wolfram Mathematica?

I have about 130 projects that I would like to collaborate on, and I have looked EVERYWHERE to find a tutor mentor but I just can't seem to find one.

Also, if anyone is interested in discussing and making microtonal music, then please let me know,

Regards,

Mr. S R U.

Michael L
KVRAF
3871 posts since 25 Jan, 2014 from The End of The World as We Knowit
This is the first time I have seen Mathematica discussed here! It has possibilities:

https://reference.wolfram.com/language/ ... ssing.html

https://reference.wolfram.com/language/ ... ssing.html

ursellsarn
KVRer

Topic Starter

12 posts since 5 Sep, 2020
Thanks for that!

I need to send notebooks to people and to collaborate with people about my concepts and creations.

I wounder if KVR is the correct place to search for these?

Regards,

Mr. S R U.

ursellsarn
KVRer

Topic Starter

12 posts since 5 Sep, 2020
I tell you what I did, now that I remember, using Mathematica.

Firstly I cut a half hour's sample of Anthony Hancock's Dead Poetry Society up into quarter second sample and I scrambled them up randomly, kind of like The Beatles did in the Sergeant Pepper's Lonely Hearts Club Band album, and I also too a minutes speech by charlie Chaplin and I reversed the digits on the audio sample using Mathematica, Indio-Arabic style, -thus, 2346 would become 6432 and 78908 would become 80987 as sample depth. I wish to experiment with/by multiplying the sample's by different numbers and converting them into different bases like 3, 5, 16, 17 23 etc...

Get the idea?

Any help and advice on using Mathematica would be very much appreciated,

Kind regards,

Mr. S R U.

Michael L
KVRAF
3871 posts since 25 Jan, 2014 from The End of The World as We Knowit
Now I understand! I like Mathematica, and its very well documented, but the obstacle for me has also been that its difficult to find other users, so I have stayed away so far.

You need to join the Wolfram Community
https://community.wolfram.com

in their Signal Processing and Sound & Music groups:
https://community.wolfram.com/content?c ... processing
https://community.wolfram.com/content?c ... nd%20music

I think you should describe your overall goal, and illustrate it with some projects. Then people will get a better idea of what you are trying to do and how it may intersect with their own interests.
For example, I do not see anything about microtonal or any other music, as your heading suggests.

Best wishes,

Mr. M L

BertKoor
KVRAF
13332 posts since 8 Mar, 2005 from Utrecht, Holland
A forum search on some keywords suggests there is one particular user that might contribute some knowledge to this discussion. Hailing cytospur:
cytospur wrote:
Mon May 11, 2015 2:14 am
[...] Wolfram Mathematica 10 (available for free and usable for this sort of stuff on a Raspberry Pi2 running the Noobs distro) [...]
We are the KVR collective. Resistance is futile. You will be assimilated.
My MusicCalc is served over https!!

cytospur
KVRian
1424 posts since 26 Jun, 2002 from London, UK
I'm here
Wavetables for DUNE2/3, Blofeld, IL Harmor, Hive and Serum etc: http://charlesdickens.neocities.org/

Music: https://soundcloud.com/markholt

cytospur
KVRian
1424 posts since 26 Jun, 2002 from London, UK
As Michael L suggests, the Wolfram Community is worth joining. There is also the Mathematica Stack Exchange:

https://mathematica.stackexchange.com/

I'm also happy to help in any way I can.
Wavetables for DUNE2/3, Blofeld, IL Harmor, Hive and Serum etc: http://charlesdickens.neocities.org/

Music: https://soundcloud.com/markholt

ursellsarn
KVRer

Topic Starter

12 posts since 5 Sep, 2020
I am trying to implement a base form function in Wolfram Mathematica, so I will check the forum....

Thanks for the feedback!

Michael L
KVRAF
3871 posts since 25 Jan, 2014 from The End of The World as We Knowit
FYI, the Wolfram Technology Conference for 12-15 October (\$195 regular /\$95 educator, govt, retired) now has program previews. There is a theme that includes music topics, but no music talks are listed yet.
https://www.wolfram.com/events/technolo ... ence/2021/

cytospur
KVRian
1424 posts since 26 Jun, 2002 from London, UK
ursellsarn wrote:
Mon Sep 20, 2021 5:19 pm
I am trying to implement a base form function in Wolfram Mathematica, so I will check the forum....

Thanks for the feedback!
Is this what you want?

In[1]:= baseConvert[number_, baseform_] := ToExpression[IntegerString[number,baseform]]

In[2]:= baseConvert[546, 3]

Out[2]= 202020
Wavetables for DUNE2/3, Blofeld, IL Harmor, Hive and Serum etc: http://charlesdickens.neocities.org/

Music: https://soundcloud.com/markholt

ursellsarn
KVRer

Topic Starter

12 posts since 5 Sep, 2020
Yes, Cytospur, this is the sort of thing that I want, and I need to multiply all an audio object's samples by a number, to convert them to (whatever) base, then to reverse the digits, to access exactly what effect that this has on the finished sound...

Someone told me that I would, if I applied this method to a piano sample just get noise, -I mean, the fact that you brain perceives a pattern in the data, does not necessecarily mean that your ear will...

Thus, I might have a piano sample's sample depth of 245 (in base_10), I might multiply this by 7, to get 1715 (in base_10), then I might modify this to base_14 to give:

8a7.

Now, reversing this, I get:

7a8.

Converting 1715 to binary, I then get:

11010110011,

...and...

Reversing the digits I the get:

11001101011.

I wish to use all manner of multipliers and bases on all manner of audio objects, piano samples, organs, guitars, human speech...etc...

Can you please (only if the forum's rules allow this, however...) give me an E-Mail (only if you are comfortable with this) such that I can send you some Mathematica notebooks.

Is this OK/alright by you?

Regards,

Mr. S R U.

cytospur
KVRian
1424 posts since 26 Jun, 2002 from London, UK
PM'd
Wavetables for DUNE2/3, Blofeld, IL Harmor, Hive and Serum etc: http://charlesdickens.neocities.org/

Music: https://soundcloud.com/markholt

cytospur
KVRian
1424 posts since 26 Jun, 2002 from London, UK
You can modify the previous function using StringReverse to get what you want:

baseConvert[number_, baseform_] :=
ToExpression[StringReverse[IntegerString[number, baseform]]]

baseConvert[1715, 2]

11001101011
Wavetables for DUNE2/3, Blofeld, IL Harmor, Hive and Serum etc: http://charlesdickens.neocities.org/

Music: https://soundcloud.com/markholt

ursellsarn
KVRer

Topic Starter

12 posts since 5 Sep, 2020
HERE IS SOME CORRESPONDENCE BETWEEN A FRIEND AND MYSELF...

I'll tell you what...

I have just realized that we may well have two main variants on the programming-in-Mathematica thing going on....

You see, once, circa 2007 I knew this bloke here in Wellington, New Zealand, who was really into computer programming and he told me that often with these programming problems that he would encounter, was a situation which would occur in which there were more than one way to programming an algorithm to make a solution.

So, it would appear (as I said above) that there are two main variants on the "reversing the digits of an audio sample thing", these being namely the "Cytospur Variant" and the "Sarn Ursell Variant".

So, I will attach them both to this E-Mail that I am sending to you, and in this correspondence I will analyze them, briefly...

Anyway, please take your time with them, and I do not wish to overload you will too much demanding stuff, as I appreciate it that your are very busy...

Firstly, here is the Cytospur variant, which I will take apart and analyze.

I will need help with this and here it is...

The "Cytospur variant":

piano = AudioData[Audio[SoundNote["C", 5, 1]]][[
1]];(*This is using Mathematica's built-in audio samples*)

<Sarn says> I assume that this is using a built in feature of Mathematica whereby it sounds a middle C note, at a certain volume and for a certain length.

The "5, 1" part of of this line of code assumedly tells us the volume/amplitude of the note, and also the length of note.

As you mentioned to me before [[1]] is the pound channel.

base7 =
Reverse[IntegerDigits[Round[Abs[512 #]], 7]] & /@
piano;(*This converts each sample to base 7 as a list of \
integers*)

<Sarn says>The "512 #" in the inner parenthesis I now understand, although I was under the impression from my experience of audio and my own personal readings that
16-bit sound samples are -(2^15)--->2^15 or -32768--->32768.

Of course, you can have any number that you so desire, and, personally, I think that "32768 #" would be better because there are mote things tat can happen with this, and there is not much scope for interesting things to happen with a meager 512 #.

Also, I realized that the specific base including the specific number within the inner parenthesis will effect the finished sound result differently.

The "Reverse[IntegerDigits[Round[Abs etc..." part of this line of code just tell the computer working within the Mathematica programming environment how to alter the piano sound at middle C one unit volume and five units length (decibels and seconds, I believe).

This part of the line of code: "&/@" tells us to map the function ("&"), onto ( /@") the piano sampled sound, and is a new one on me.

We live and learn!

).

Essentially we now have a "list-of-lists" which tells us that each of the piano sounds samples (a list) exist in a list of samples (the *.wav form).

So, essentially, we have a list of lists, this I understand!

flatList =
ToExpression /@
Flatten[base7];(*This creates a flatten list of the previous list \
of lists*)

<Sarn says>Ah yes indeed... To "flatten" a list...

This essentially is roughly/vaguely the opposite of partitioning a set.

Personally I partitioned and scrambled an audio file one just for fun like the Beatles did in the world famous album Sergent Pepper's Lonely hearts Club Band.

So essentially this "anti-partitions" the list of lists, and assumedly is an essential stage in the procedure.

removeDC = # - Mean[#] &@
flatList;(*This removes the DC offset in the signal*)

<Sarn says>You'll have to explain this line of code to me.

Quote an isolated example.

I mean to say "mean" (no pun intended) is the average sample depth of the sample in this list within the list, but I cannot really understand how it works.

normalize = #/
Max[Abs[#]] &@
removeDC;(*This normalizes the signal to between-1 and+1*)

<Sarn says>Again, -You'll have to explain this line of code to me.

Quote another isolated example.

output =
Audio[GaussianFilter[final, 8],
SampleRate ->
44100]

(*This is the final audio output with a lowpass \
filter applied to reduce the noise a higher value filters more*)

<Sarn says> How exactly is this applied to the "normalize" variable.

Why would you want to use it?, -Look, I think that I am missing something.

You will have to explain this to me.

I tried to run this small "Cytospur" variant program, and I got what I think were two error messages, and so I attach a *.jpeg file which shows this to this e_Mail.

And, now, for the Sarn Ursell variant of the sample list-of-lists digit reversal.

This to me is much more straightforward.

You told me that you thought that the reason taht the digits of the sample were not being reversed was that Mathematica is fussy, and that it would only do this with audio data, and so I modified the code such taht it still was dealing with audio data, and yet the error message still comes back to annoy me, and it is REALLY STARTING TO BUG/ANNOY ME!!!.

Anyway, -I attache both program variants and *.jpegs to this E-Mail, for your viewing leisure.

Here:

The Sarn Ursell variant of audio digit reversal:

CharlieChaplinSpeach =
AudioData[
Import["F:\\Mr. SRU-Hobbies and Interests 2006-2021\\Find Sounds \
Samples, And Wavs To Use\\Find Sounds\\Charlie Chaplin Speach.wav"]][[1]]

CharlieChaplinSpeachMultiplied = CharlieChaplinSpeach*1000000

CharlieChaplinSpeachMultipliedAbs = Abs[CharlieChaplinSpeachMultiplied]

CharlieChaplinSpeachMultipliedAbsRound =
Round[CharlieChaplinSpeachMultipliedAbs]

CharlieChaplinSpeachMultipliedAbsRoundAnotherBase =
BaseForm[CharlieChaplinSpeachMultipliedAbsRound, 6]

CharlieChaplinSpeachMultipliedAbsRoundAnotherBaseReverseDigits =
IntegerReverse[CharlieChaplinSpeachMultipliedAbsRoundAnotherBase]

Export["Charlie Chaplin Speach with Digit's Reversed",
CharlieChaplinSpeachMultipliedAbsRoundAnotherBaseReverseDigits ,
"wav"]

I am dealing with Audio Data now, and yet...the program still will not run, it would appear that Mathematica does not like using IntegerReverse on audio data, and I attach a *.jpeg of the error message that I got when I tried to run the program...

Please advise me, and instruct and also to suggest things to me.