Espruino-based Guitar Pedal #4304
Replies: 1 comment
-
Posted at 2014-10-11 by @gfwilliams 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. Posted at 2014-10-11 by @gfwilliams 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... Posted at 2014-11-03 by stephaneAG 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 ( .. ) Attachments: Posted at 2014-11-03 by @gfwilliams 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. Posted at 2014-11-08 by stephaneAG Hi again ! :) -> I just woke up & had some time free to enjoy a littl' journey on hackaday ... => 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 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'<stuff_here> 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 ? 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 ? ) While 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 Whoppsie, message already too long, I stop now & post the schematics for the above pedal in case it may help ;p Attachments: Posted at 2014-11-10 by @gfwilliams 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! Posted at 2014-12-18 by stephaneAG 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: => Some time ago I stumbled upon this: => About OnlineSCAD: 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 ?
** 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 ( .. ) Posted at 2014-12-19 by @gfwilliams
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!
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:
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 Posted at 2015-01-05 by stephaneAG -> 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 ) 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 :( Also, I have some updates [ that still need updates :/ .. ]: -> I had littl' tile to test the headset jack <-> Espruino UART thing, and ..
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: 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 ? :) ) 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 ( .. ) ** Espruino headphone jack as UART using a TRRSplug **** tiny [tidy on the front / not on the back ] version **** breadboard version **Attachments:
Posted at 2015-01-05 by stephaneAG .. Back after a huuuge backup & the so-called update [ pfff.. ] -> webGl is now supported ( Yayyyy !!!^^ ) After a quick try with the above page, still no luck, but I may investigate the why (..) Attachments: Posted at 2015-01-05 by @gfwilliams 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:
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:
You could then type using the terminal webpage and see if you can get anything received. Posted at 2015-01-06 by stephaneAG Thanks for the quick answer ;) -> all right, I was definitely tired .. 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
-> 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 ( .. ) ) Also, may this come from the need of a 10uF cap you talked about in your opinion ? Thanks again for your time ++ Attachments:
Posted at 2015-01-06 by @gfwilliams 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 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 I don't suppose you have an oscilloscope? It might help to see what's going on... Posted at 2015-01-06 by stephaneAG 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) .. " ) -> 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 -> 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 Attachments: Posted at 2015-01-06 by stephaneAG Back ! => so: 1: using my webpage & audio_serial_inverted produced the following output:
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*
Attachments: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-10-11 by stephaneAG
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
Beta Was this translation helpful? Give feedback.
All reactions