Garble Marvel 1.05 update: voice synthesizer with source

Developed or developing a new product in PureBasic? Tell the world about it.
doctornash
Enthusiast
Enthusiast
Posts: 130
Joined: Thu Oct 20, 2011 7:22 am

Garble Marvel 1.05 update: voice synthesizer with source

Post by doctornash »

Well, to be precise, Garble Marvel generates a sequence of voice-like utterances (with an emphasis on vowel-like inflexions) according to user settings.

Hours of fun and could even be useful for your music productions :D

Thanks to the purebasic community here who've helped me out on some coding questions along the way.

I've included in the zip the source files, since the code practically demonstrates a variety of audio synthesis and processing algorithms (synthesize a saw wave, filter it, pass it through 3 parallel resonators, apply gaussian envelope to the sound, apply chorus, low/band pass filtering, a multitap delayline, amplitude modulation etc) so the project would be useful for all those seeking to roll their own audio apps. Feel free to evolve/build on the app, just 'keep me in the loop' :wink: Actually, if anyone can provide tips as to how to opensource this on sourceforge or something similar, I'd be grateful.

So far, I've tested the .exe on win 2000, win XP and win 7, and appears to work OK on those. Feel free to compile on other platforms, and let me know how you go.

If you just want to run it, plonk the exe and portaudio dll in the zip into a directory, and execute the exe. If you want to load the project, unzip all the files into a directory, and double-click garblemarvel101.pb.
Image
Here's an example of its output:
http://soundcloud.com/doctornash/garblemarvel101
And here's the download:
http://www.mediafire.com/?ecrp36nn2u92iac

For those wanting more info first, here's what the Help of the app says:

*Press the 'speaking face' button to generate your garble

*Your generated garble will repeat if you tick the Repeat checkbox and then press the 'speaking face' button

*Select File>Save to save your garble sequence, and File>Open to load it back in
Note: Once you load a file, the Repeat checkbox will be auto-ticked. If you leave it ticked and then press
the 'speaking face' button, the loaded file will play, otherwise a new garble sequence will be generated
Also, please note that this file is not a standard audio file playable in a media player

*Duration slider: adjusts the duration of garble from a fraction of a second to a few seconds

*Frq From And Frq To sliders: sets the pitch range of the generated garble. All garble segments will be of a note pitch
randomly selected from within this range

*Num Of Sgmts: number of discrete voice segments in your garble sequence

*Min Sgmt Length: the minimum length of any voice segment in your garble sequence
Note: Garble Marvel uses a 'brute force' technique to satisfy the specified number of segments and minimum segment
length in the sequence duration. If Garble Marvel is unable to create a sequence fitting the criteria after a few seconds
of calculation, it will automatically adjust the Duration slider to a level allowing a sequence to be generated. You have
a good chance of your criteria being met if you do not push both the minimum segment length and number of segments
sliders to near maximum for long duration sequences

*Env: adjusts the bell-shaped level envelope imposed on each voice segment. The shape will vary from 'squished'
to 'streteched out'. Useful for smoothing the transition between segments, or simply use as an effect

*Effects on segments: If you tick an effect in this group, the effect will get randomly applied to segments in your sequence

*Filter: randomly applies bandpass and low pass filters to segments

*Metallic: randomly applies a multi-tap delay line with very short delay duration to segments

*Chorus: randomly 'harmonizes' segments. The extent of harmonization can be adjusted with the slider. At extreme settings,
the chorus will transofrm to a 'warping effect' rather than a harmonization

*Wobble: randomly applies tremolo to segments. The tremolo rate can be adjusted with the slider. At extreme settings,
the tremolo will sound more like a ring modulator effect
Last edited by doctornash on Fri Dec 23, 2011 9:01 pm, edited 1 time in total.
User avatar
skywalk
Addict
Addict
Posts: 4003
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by skywalk »

Very cool Doc. 8)

Some tiny comments:
CreateGadgetList is not needed.
#PI is a built-in constant.
So, you can make another constant #PI2 = #PI*2
Use 'Protected' instead of 'Define' in your Procedures.
Use 'EnableExplicit'.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by infratec »

Hi,

sounds nice :!:

But...., sorry to say, a bad readable code.

I found a bug and tried to eliminate it.
So I first reformated the code.
Than I eliminated the Gosubs.

Than I eliminated the bug:

If you start the program an press the 'play' button it's ok.
Than put the Duration to the lowest value and press 'Play' again.
The program crashes.

My bugfix:
Change

Code: Select all

ProcedureC PaStreamCallback(*in, *output.Float, frameCount, *timeInfo.PaStreamCallbackTimeInfo, statusFlags, *userData)
  For Im = 1 To frameCount
    *output\f = FinalGranularArr(nm)
    *output + 4
    nm + 1
    If nm >= ArraySize(FinalGranularArr()) : nm = 0 : EndIf
  Next Im
EndProcedure
To

Code: Select all

ProcedureC PaStreamCallback(*in, *output.Float, frameCount, *timeInfo.PaStreamCallbackTimeInfo, statusFlags, *userData)
  For Im = 1 To frameCount
    If nm >= ArraySize(FinalGranularArr()) : nm = 0 : EndIf
    *output\f = FinalGranularArr(nm)
    *output + 4
    nm + 1
  Next Im
EndProcedure
The SelectUtterance() procedure is a big :?: for me.

Bernd
doctornash
Enthusiast
Enthusiast
Posts: 130
Joined: Thu Oct 20, 2011 7:22 am

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by doctornash »

Bernd, thanks for the feedback! It's strange that the program has not crashed on any of the 3 machines I have with 3 different Windows OS's (Win 2k, XP, 7) when I do as you indicated :?
If you start the program an press the 'play' button it's ok. Then put the Duration to the lowest value and press 'Play' again. The program crashes
But I shall incorporate the change you have suggested in PaStreamCallback, if this prevents a crash on your system.

BTW, any chance of your posting the reformatted code with the gosubs removed?

The SelectUtterance procedure is simply setting the coefficients of the parallel resonators to produce the voice segments. This type of thing:

Code: Select all

If SelectTheVoice = 1
SelectTheVoice = 4
is simply a carry-over from my original list of utterances, which had a lot more voice possibilities. I got rid of a lot of them
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by infratec »

Hi,

please check your PMs.

Bernd
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by infratec »

Hi,

I have to apologize.

The crash was coming from my 'improvement'.
I forgot to set nm and im to 0.

Bernd
doctornash
Enthusiast
Enthusiast
Posts: 130
Joined: Thu Oct 20, 2011 7:22 am

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by doctornash »

This is how the application is showing up on my friend's MAC. The slider pointers are much bigger than on the Windows rendering, but the captions are the main problem. For the text labels to show up correctly, does one need to explicitly specify font type and size in the code? Am assuming it is solveable? Just doing it like this at the moment:

Code: Select all

CheckBoxGadget(#CheckBox_Metallic, 330, 80, 60, 20, "Metallic")
Image
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by MachineCode »

Am I the only person who doesn't get the purpose of this app? Doesn't sound like a person, and I have no idea what it's meant to do? The icon makes it look like it produces synthetic speech? Is that right? Because it sure doesn't sound like it.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
infratec
Always Here
Always Here
Posts: 6883
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by infratec »

Hi doctornash,

the problem is the different default font size.
Add something like this:

Code: Select all

LoadFont(0, "Arial", 8)
SetGadgetFont(#PB_Default, FontID(0))
Bernd
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by netmaestro »

I forgot to set nm and im to 0.
Oh no! I'm null! :shock: And I can't im anybody! Aaarghh!

Ontopic: Thanks doctornash, very interesting stuff.
BERESHEIT
User avatar
bobobo
Enthusiast
Enthusiast
Posts: 202
Joined: Mon Jun 09, 2003 8:30 am

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by bobobo »

cool :D
사십 둘 .
doctornash
Enthusiast
Enthusiast
Posts: 130
Joined: Thu Oct 20, 2011 7:22 am

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by doctornash »

Am I the only person who doesn't get the purpose of this app? Doesn't sound like a person, and I have no idea what it's meant to do? The icon makes it look like it produces synthetic speech? Is that right? Because it sure doesn't sound like it.
I tried to summarize what it's about in the first sentence of the announcement:
Garble Marvel generates a sequence of voice-like utterances (with an emphasis on vowel-like inflexions) according to user settings. Hours of fun and could even be useful for your music productions
Apologies if the 'speaking icon' is misleading, I'll try to come up with another. However it should STILL sound like sounds from a vocal tract, because the resonant filters in the app serve to sculpt frequencies in a similar way to our glottis. Generation of a form of 'contorted speech' is an eventual goal, but in the meantime, I wanted something that could generate useful phrases and sequences for music production...I was looking to create something a bit different from vocoding/talkboxing/pitch modulation effects (all of which I've implemented in my all-in-one music production synthesis-sequencing-effects-mastering application Flexibeatz, built in VB http://flexibeatz.weebly.com/) but which nevertheless was complementary to those effects and useful for 'spicing up' tracks. In that regard, I think Garble Marvel does the job and I'm working on a couple of tracks to show how its output can be incorporated. I say 'contorted speech' as a goal, because there are many challenges in producing even marginally intelligble speech...creating the individual sound elements beyond the vowels such as voiced consonants ‘b’, ‘d’ and ‘g’ and even voiceless consonants like 'p', 't' and 's' is part science, part trial and error, necessitating plenty of experimentation time, and then morphing them smoothly into the vowels and other elements (eg 'hot': h - o - t) is also not trivial. I'll concentrate on diversifying the utterances produced by Garble Marvel first, and then move onto a few short words production, and retain only those which sound authentic (but a full-on speech engine is not an intent)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by blueznl »

Dumbfounded. Amazed. Impressed. (And very, very puzzled 8) )
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
doctornash
Enthusiast
Enthusiast
Posts: 130
Joined: Thu Oct 20, 2011 7:22 am

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by doctornash »

I guess some puzzles were never meant to be solved :D
User avatar
DoubleDutch
Addict
Addict
Posts: 3219
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: Garble Marvel 1.01: a purebasic voice synthesizer

Post by DoubleDutch »

Sounds great. :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply