-
• #2
Hi,
I'm afraid that right now you'll really struggle... While the implementation is quite easy, javascript code on Espruino just isn't fast enough to process audio at the rate required for decent quality sound.
I think you'd be better off with something with a bit more oomph - like a Raspberry Pi or native c code on an arm arduino board.
-
• #3
Of course the other option is to look at some analog circuits to do what you want, but then to control those from the Espruino. That could be really cool...
-
• #4
Hi there !
Sorry for the delay, I had review your answer but didn't have the time to invest more the subject / writing back to you ( .. )
I guess I'll be opting for analog circuits controllable via Arduino/Espruino, or even use the uCs to modify the output in some way ( using PWM & some ADC/DAC stuff ( .. ) )
I recently ( yesterday ) had one guitar pedal enclosure drilled to be able to fit components in it, & as soon as I achieve a neat little circuit for audio, I plan to use the second one I have to do as explained with uCs ;)
Still, the need for flexible wires ( & correct diameter drills ) is coming, as well as maybe the PCB one ( the enclosure I'm using is actually quite tiny ), & but I'll be able to purchase some of that stuff soon, hopefully :)
Last but not least, I heard about Espruino pico today on hackaday, and all I got to say is "Congratulations!" [ & thanks for that neat littl' uC in js ;p ]
follows, my first implm of a guitar pedal, quite basic, but you know how first times are ;D
I'll be back as soon as I can ( .. )
Thanks again, I wish you luck ( but do you need any ? ;p ) for the Pico ;p
+
2 Attachments
-
• #5
Wow, looks good! Let us know how you get on with it...
One thing that might be pretty cool: Espruino can play back waveforms (including repeating them). You could use that for things such as tremolo, where you could choose the shape of the tremolo waveform.
You could also use it as a simple low-fi 'repeat box' - so it'd record while a button was pressed and would then loop it back. I have some code that I'd written for that that I can post up, but the lack of memory means you can't get a very high sample rate out of it if you want to repeat more than a second or two.
-
• #6
Hi again ! :)
-> I just woke up & had some time free to enjoy a littl' journey on hackaday ...
.. & stumbled upon your js based FSK for 2 way comm using the audio jack ;D=> neat !
Actually, it opens a lot of possibilities, and without the overhead ( in hardware size, at least ) of having a "audio jack modem" for FSK comm to an Arduino for ex ( I 've seen, as you sure did too, many videos on how to use such peripheral to have webapps comm to uCs ( mainly Arduinos ) ).
Anyway, big hardware or not, this is definitely the kind of stuff I wanna have in my toolbox, even if I had to build stg from scratch ( at least to know the inner workings like I like to ;D ).
It also make me wonder how hard it'd be to use another espruino[/pico] to interface the dock of the apple tablets ( I own a "RedSpark cable" to do so, but it needs it's dedicated library ( Obj-C ), and what I did found a way back, for iPods & other "MY-EGO" devices, was not more than how to get/set the "basic" commmands ( if I recall correctly, play/pause & prev/next ) )
=> Considering the size footprint of the Epruino ( and the Pico ;) ), we could have some really thin overhead & added possibilities WITHOUT paying any $$ fee :).
For the playback waveforms possibilities of the Espruino,yup, I digged / took quite some notes from your tutorials on the Espruino website ( & also in the sections dedicated to PWM & stuff ( .. ) ), & the use as a quick low-fi 'repeat box', as you call it, 'd be a simple yet neat littl' build to start with before emphasizing the project / build others upon it
=> this make me wonder if we could find a way to use the audio jack of,say a tablet, to pass audio to it, use it to stock the stuff we can't hold on the espruino due to the lack of memory, & then trigger the playback of the stuff from the espruino by sending some message over the audio
( R: I just woke up, & maybe dreamed about line-level hackety mumbo-jumbo ;p )In any case & joke(s) aside, the lack of memory is mentionned in many ( all ? ) the tutorials / docs I could read on building a 'low-fi' with Arduino's for ex, & the due/decimilia or mega were considered necessary, at least to be able to do the ADC/DAC part in an effective manner ( wayyy too much notes on this I gotta to test-implm, but as I told you already, time is running out by now .. :/ )
Is there a way known to you to use, for ex, 2 Espruinos || some specific external memory ( an Espruino "compute" extension ? ;p ) to benefit from the added memory ?
=> I was planning to find some DAC /ADC chips ( maybe from TI I guess .. ), and if I come across some well-known / used for audio stuff memory chip, I'd be glad to buy it & add it to the overall project(s)Last but not least, but on quite another subject, how fast do you think we can receive data from the Espruino to a tablet ( aka do we have a fixed max baud ? )
=> I recently [ actually yesterday ] had to digg OpenJsCad ( 'got to port OpenSCAD code to Js ( .. ) ) & fooled around the OpenJsCad.org default UI to get something closer to my expectations while hackin around ( https://www.youtube.com/watch?v=Dl5DfWqfBas
=> no comment, I was happy & tired ;) ), and one othe stuff I plan to implement was shortcuts to control the view of the 3d object while I have the script editor in focus ( actually taking 1OO% of the width of the screen )
=> it's visually very close to what we have in your web IDE when activating the webcam in the background, with just the video feed being this time a 3d object being generated/configuredWhile it's visually appealing ( ok, I loved that feature in the Espruino IDE: simples yet practical for screencasting, etc .. ), an external controller 'd also be neat
=> now, what about running that from a tablet ( R: needs WebGL activated, as I didn't have the time to A: build an iOS wrapper app / B: maybe use Three.js & an alternative Canvas renderer ( .. ) ) & have for example a control board with few buttons & a joystick to do stuff ( .. )Whoppsie, message already too long, I stop now & post the schematics for the above pedal in case it may help ;p
1 Attachment
-
• #7
At the moment there's no 'nice' way to access external memory - you'd have to write code to read/write blocks of data via SPI. Having said that, you might find that the SD card is quite useful. You can stream sound off of it pretty reliably. I haven't tried streaming sound to it, but I think you could do that too.
If you're connecting to a tablet via USB you can really push data though. I think the real maximum via audio is 22000 baud, and i'm not sure how reliable it'd be.
OpenJScad looks really cool. I'd actually done a proof of concept a few years ago right here before I found someone doing something similar. I'm glad it's really been polished now - I'd definitely use it in preference to OpenSCAD!
-
• #8
Hi there!
thanks for the update ;)
=> now I wonder if we may be able to find a way to "select" to use the audio jack || the dock:
-> this would mean an easy way to have audio out & commands/effects programmable via audio as well=> Some time ago I stumbled upon this:
https://pedals.io/
http://dashersw.github.io/pedalboard.js/
-> it's actually kinda neat ( kudos to @dashersw, the author ), and I'd be amazed to get that working in tandem with Espruino in a mobile-first interface/layout ==> LOTS of possibilities ;D=> About OnlineSCAD:
-> I actually visited the website a while ago, looking for a scriptable CAD offering possibilities & flexibility beyond using Rhino/Blender+Python scripts ..
.. and reading about OpenJsCad once again made it my best bet to replace OpenSCAD in my toolbox ..
.. funny enough, kudos to you, I actually didn't knew you were the author :)Last but not least, I received yesterday an ADS1115 breakout board ( 16-bit 4-chans ) from Adafruit ( :p ), digged the doc a bit ( didn't have time to have fun with it yet :/ .. ), and 'll check what I can achieve with Espruino as soon as possible ( it uses I2C to communicate, so this 'll be my first try on this with Espruino, although I expect some debug needed to use 4 of these boards together & their addresses ( .. ) ).
This being said, the other breakout board available offers higher sampling rate ( this one focusing on higher resolution ), wich could have been better ( free guess ? ) for audio apps
After that, it's up to coding some effect wrapper in js ( to keep a standardized coding style ), some so-called effetc(s*) & outputting in PWM if I'm right ?
- as seen on pedals.io, an effect chain of parametric effects 'd be gorgeous** !!
** aka maybe have on the tablet the interface with controls representation related to the controls present on the Espruino, & having the ability to push the so-called effects code ( & if used or not ) to the Espruino to allow its use without any other peripheral connected => sound quite neat to my ears :D
Also, I gotta find some cheap audio<->bluetooth dongle to test the jack audio comm from a tablet ;p
I'll give updates as soon as I time to do so ( .. )
in the meanwhile, happy holidays ;p+
- as seen on pedals.io, an effect chain of parametric effects 'd be gorgeous** !!
-
• #9
OnlineSCAD I actually didn't knew you were the author :)
Nooo... I'm not the author at all! I just got fed up with OpenSCAD and thought that using JS would be a great idea. I hacked something up and then realised that OnlineSCAD (or its predecessor) already existed!
ADS1115
I'm not quite sure I understand why you'd want this? Espruino has many analog inputs built into it. They're only 12 bit, but you're not going to be able to grab data at audio speeds via I2C anyway.
I guess one option would be to:
- Put bluetooth audio in/out inside the pedal
- Attach an HC-05 bluetooth module to the Espruino, and connect all your switches and buttons to the Espruino
- Write an Android app for the table/phone that found out what all the buttons were set to via Bluetooth and then did all the audio transforms on the tablet
Sadly iPhone/iPad couldn't be used, as Apple block Bluetooth serial ports for some reason. I guess you could use an HM-10 and then transmit the switch states via BLE
- Put bluetooth audio in/out inside the pedal
-
• #10
-> Ok, got it! ( sorry for the whoopsy ;/ )
-> Yup, using Js for such things is just awesome ( Nb: I still can't get my hands on any canvas renderer for OpenJsCad, & may be looking on Three.js & ThreeX.js plugins to get that functionality ( I wonder if we could have the best of both world, aka parametric mesh in real time ( thx to OpenJsCad ) with canvas renderer & other niceties ( animation, .. ) thx to Three.js )
=> also, a dedicated controller on an Espruino controlling the so-called mesh parameters 'd neat ;)I actually had some tests in mind to do with some ATtiny85, but as you said I2C is not fast enough for some needs ( .. )
=> for the iPad/Android phone/tablet part, I guess we don't have any access to BLE peripherals from a WebView :(
This being said, using the HM-10 BLE ->UART i a neat idea indeed!Also, I have some updates [ that still need updates :/ .. ]:
-> I had littl' tile to test the headset jack <-> Espruino UART thing, and ..
.. I couldn't get it to work with neiher my iPad, an android tablet, nor my computer :/for the iPad, this may be normal, since WebAudioAPI requires iOS7 & above ( see I guess I'll have to upgrade my 5.1, & it well as migh bring WebGL to mobile Safari if I'm not wtong ( gotta check caniuse .. ) ;p )
for the android tablet, it may come from the OS version ( 4.0 ), since WebAudioAPI are supported in Android Chrome 39
I got an Android phone ( GooPhone ;p ), but the results are the same :/
for my computer, it supports WebAudioAPI, but I've seen that it seems to detect the TRRS cable for headset & microphone only when I don't plug it fully-fully ( may come from the jack entry used, but that's what appeared in the Ubuntu Audio Prefs :| )
Nb: for all the above devices, I even tried typing " javascript: audio_serial_write('LED1.write(0);'); " but no success either with it
Also, worth mentionning, the webpage I used is hosted here:
madtoyslab.com/Espruino
( when trying one of the procedures exposed in EspruinoOrion, I only get glitches in the "console-like" page )Not knowing if the trouble was coming from my wirings or the tiny circuit I did build [ in hurry ], I did a tidier version of your circuit on a breadboard, & made another jack plug as mentionned ( both are using TRRS to have 2-ways comm possible ), but it the result is the same as the tiny version :/
I am willing to backup the iPad I got & do that *** update ( if I get WebGL for OpenJsCad on it, it seems fair .. :/ ) & retry my tests when I got this damn mobile Safari WebAudioAPI support, but just in case, I didn't clearly get where I'd put a 10 uF cap ( would you please point it in one of the breadboard pics ? :) )
=> this may help to re-do my tests on the different devices ( .. ) :)I also post some pics I took when building the 2nd version of the cable in case it may help someone [ and that maybe one of the forum member 'll take the time to add a tut with them on how to have jackUART with Espruino [ & links to a "standalone" code for the 2-way comm' ] / be added to the EspruinoOrion github page, for clarity's sake ]
If I can, I'll be back right after doing that pad update, to tell you how it went ( .. )
Last but not least, the firmware update from the Espruino IDE worked flawlessly ;)** Espruino headphone jack as UART using a TRRSplug **
** tiny [tidy on the front / not on the back ] version **
** breadboard version **
14 Attachments
-
• #11
.. Back after a huuuge backup & the so-called update [ pfff.. ]
-> webGl is now supported ( Yayyyy !!!^^ )
-> WebAudioAPI also seems supported but after diggin' around HTML5 examples, only one made its way on iOS: it seems we have to "unlock" audio 1st in order for things to work (..)After a quick try with the above page, still no luck, but I may investigate the why (..)
Nb: it gave me an error while I was messing around with javascript in bookmarks ( we canno more have javascript in the browser bar it seems .. :/ ), see the joined image+
1 Attachment
-
• #12
The circuit looks fine, but I'm not sure about your resistor values. I'd expected to see an orange band (eg. 47k = yellow(4), violet(7), orange(20^3) ) but it looks like you have black - which'd just make it a straight 47 Ohms. Same for the 10k as well.
To try and debug a bit, maybe:
- Open the terminal on the iPad (or something)
- Tap the reset button on the Espruino board (while it's powered from a battery of USB wall supply - not the PC) - on a 'clean' device that doesn't have anything saved to it (or has just been flashed), it should send the Espruino logo over the serial port
- If that doesn't work, try clicking the 'RX polarity' button up the top right - some devices have the wrong polarity on their inputs and outputs.
The other thing you can do to test receive is to plug Espruino in via USB and to then connect to it with the Web IDE and run something like:
Serial1.on('data', function(d) { console.log(">>>"+JSON.stringify(d)); });
You could then type using the terminal webpage and see if you can get anything received.
- Open the terminal on the iPad (or something)
-
• #13
Thanks for the quick answer ;)
-> all right, I was definitely tired ..
.. I effectively used wrong resistor values :/ .. [ & kinda feel dumb to have screwed the tinier version :/ ]this being said, "shit happends", but it's no reason no to try again ;p
=> so, after switching the right resistors for the breadboard version & building a 1-way comm cable, I tried what you suggested & got "something" ( see the screenshots ), but stuff doesn't seem to go as it should:
-> I 've never been able to type in the terminal window ( the way you did it in one of your demo videos on headphone jack UART ) => is ' prompt = "" ' normal ? ( I remember seeing that in the terminal js console )
-> using EclipseOrion & the plugin just printed glitches when testing with
Serial1.on('data', function(d) { console.log(">>>"+JSON.stringify(d)); });
-> I also got glitches when using the page already mentionned ( http://madtoyslab.com/Espruino ) & using udio_serial_write()
I managed to get more "stable" signal tweaking my OS audio settings, & it seems that the 1-way cable is less prone to "be buggy*" on the host jack ( * for some reason, the TRRS cable seems to use the internal microphone when the plug is fully inserted ( or at least, that's what's displayed in the OS settings ( .. ) ) )
Last but not least, I quickly tested some code using the WebAudioAPI to check it's support, & it seems I can't get any sound playing on iOS right now :/ ( I'm pretty sure it may come from the way iOS needs an input before any sound to be played, but I gott digg stuf on that ( .. ) )
-> if you have any hint on this, the page(s) are hosted here [ with dummy-dumby code ;p ]:
http://madtoyslab.com/WebAudioContextTestsAlso, may this come from the need of a 10uF cap you talked about in your opinion ?
Thanks again for your time ++
3 Attachments
-
• #14
It looks promising in the first image - the terminal sends some commands when it starts up, but there is some garbage at the end (it's not that some other app played a notification sound or something like that?).
I wouldn't bother with the Orion plugin for now - it just complicates matters. All it does is dumps text into the terminal window - which you could do just by pressing keys on your keyboard.
The lack of two-way comms could be because your input volume and input source wasn't set correctly? You want the input volume at 100% (not amplified). You can test it out by opening the terminal webpage and then issuing
Serial1.print("Hello World")
from the Web IDE.Also, did you really want the balance over to once side? I'm not sure if that would help.
In the code that you'd made, you could try adding
audio_serial_invert=true
. It might help as it could be that the sound output is inverted?I don't suppose you have an oscilloscope? It might help to see what's going on...
-
• #15
Allright .. actually, not, but here's what I came with during my last test(s):
-> in principle, I tested with no other app opened, so a notification sound seems not likely to occur ..
-> again, concerning the index.html terminal, I've never been able to type in the actual window ( maybe u have some js fcn I can call from the console to emulate me typing in ? ), aka typing keys on my keyboard does nothing when using the 1-way comm cable ( & when using the 2-way comm cable, it prints garbage more or less like what I can have in the WebIDE when using " Serial1.on('data', function(d) .. " )
( after looking at the console logs, it may come from the way the terminal accepts input & provides a prompt ? )-> using my simple page ( http://madtoyslab.com/Espruino/ ) & using the js console to set " audio_serial_invert = true; ", I don't get glitches but chars instead :D
( see screenshot )
=> thing is, for some reason, each of them gets displayed twice ( .. ), but no more garbage :)-> concerning the balance over one side, this is just something that I did while testing ( who knows if it could have helped me in some way / gave me some hint(s) on the pb ? ), but it seems I get the same with/without doing so ( when doing the above test )
-> I am about to try with unamplified input & the 2-way comm cable, but I guess it 'll continue to either print glitches or be quiet :/
=> although, as the "glitches" we're talking about seems to reverse to normal chars when using audio_serial_invert, maybe it's the same the occurs in the terminal window ?
-> actually, I can get my hands on a DSO Nano but nothing bigger .. :/
=> now testing the 2-way cable ( .. )
Nb: using Chrome Version 38.0.2125.104 (64-bit) on zenbook UX31A & Ubuntu 13.04
2 Attachments
-
• #16
Back !
=> so:
1: using my webpage & audio_serial_inverted produced the following output:
\x00<glitch><actual_stuff><glitches>
2: on terminal refresh / opening in the browser ,I got
3: I can use "Serial1.print()" to print stuff in the terminal window :D [ "yayyyyy!" ]
[ 4: the last screenshot is a dumb tests .. as so many others .. ]
Got some work to do ( .. ), but I'll be back as usual when I can afford time to do so :)
Cheers, keep up the good work*
- yup, I'll take some Pico's now I need more Espruino's ;p
+
4 Attachments
- yup, I'll take some Pico's now I need more Espruino's ;p
Hi there !
Willing to come back to Espruino & Javascript dev after digging a little more on guitar pedals, I'd like to know if someone has already tested implementing a guitar pedal using an Espruino board.
I think it 'd be kinda nice to be able to write effects using javascript ( & be able to modify them "on-the-fly" ), and I'll digg how to do so after implementing such stuff using an Arduino board [ & maybe an ARM one ( .. ) ].
Looking forward to reading from anyone interested / having knowledge on this,
I'll be digging stuff while not back at it ;p