• Hi there !

    As said in the title, I'm working on a project that'd be pretty much a dumb controller for a laptop connected

    To achieve my goal ( playing normally / in reverse audio & altering the play speed in ~realtime ), I need the following capabilities:

    • detect touch on the discs ( presumably done using capacitive sensing )
    • detect rotation speed & direction of the discs ( ' got my little idea on that, somewhat inspired of our multimeters wheel - more on this in a later post ;p )
    • rotate the discs at a certain speed & a certain direction - as well as use them as "force feedbacks" ( when the disc is touched, to make exponentially harder turning the disc by hand as it goes far forward/ backward the original "touch position" )

    After digging a little, there seems to be many ways to do the three above steps, but I'd like to design the different parts separately / check their alternatives before having the complete circuit ;)

    • on the capacitive touch side of things, I have to test an "RC oscillator + freq comparator" circuit to see if I can rely on that, but I was wondering how hard it'd be to implm a freq comparator in Espruino ( or even write a lib that - as the CapSense lib does for the Arduino - uses a capacitive voltage divider & a touchpad directly connected to one of the uC pins ) ?

    • to detect rotation speed & direction while still being able to drive the motors to turn the discs, I plan to use traces on the bottom face of the discs that'd connect to 3 different points of a voltage divider which 'd in turn pass a specific voltage to a uC pin: sensing the 3 different voltages 'd provide info on the direction, while the change rate of the voltage 'd indicate the rotation speed. This being said, it seems we can also use motors as sensors, but gotta digg & test that to know how precise it can be ( .. )

    • to drive the motors ( which 'd be steppers I guess, to be able to drive them slowly ) normally, no troubles ( I hope ), but to use them as "force feedback", I'm wondering how to make sure I don't damage them

    Lastly, to have sort of a vinyl aspect, I originally planned to use conductive paste on a black non-conductive material & "draw concentric circles by removing matter", but it didn't end up well just while testing with acrylic paint on a copper plate I found in my junk stuff ( there are blobs of paint in places, & the result is not as clean as expected )
    I'll have to test with the cutting tool instead of a sharp wood stick to see if it renders better, or even cut in the copper plate & then get it tainted black while preserving touch capability ? ( .. )

    Right now, I'm testing my plan to detect rotation speed & dir, starting by using some conductive ink ( & hoping it 'll work as intended ;p )

    Last but not least, any hint is very welcome :D

    Thanks for the reading ;)

  • For capacitive sense, maybe check out: http://www.espruino.com/STM32+Peripheral­s

    There's code at the bottom specifically for capacitive sense on the Pico :)

    For rotation, I'd maybe look at rotation encoders. While digital, you can get some with a relatively high precision (you could even use an old ball-based mouse).

    Actually come to think of it, why not just dismantle an optical mouse and point it at the under side of the turntable? You'd have to do some poking around, but you can read the movement back pretty easily if you've got a mouse with the right type of sensor - some of them are USB only, but I think most of the cheap wireless ones are usable.

    There's a library for the ADNS5050 - because you can use it as a camera - but actually plenty of other sensors use exactly the same protocol, just without the camera bit implemented.

  • Hi there :)

    Thanks for the link on capacitive sensing on the Pico -> it seems to be precisely what I've been looking after :D
    I wonder how close the same code 'd be for the original Espruino board ..

    Now, while your suggestions are worth the look, I did find a "softpot" in my mess & took that as an opportunity for a quick hardware POC / to focus on the software ( on the laptop ).

    The softpot used seems pretty sensible from the test I ran, & right now I'm trying to think of the simplest way to track "cross limit" finger movements:https://github.com/stephaneAG/Espruino_t­ests/tree/master/SoftPotTest

    The idea is to periodically read the analog value coming from the sensor & forward it's state
    If it's smaller than previous one, then we are moving CW, else CCW.
    Depending on the difference between the previous value and the current one, we can deduce the speed of the movement.

    Once the above is done "correctly" ( handling some special cases & thresholds .. ), I have an ongoing http://stephaneadamgarnier.com/ScratchyW­AA/playMp3.htmlPOC for the software running on the laptop

    The idea is basically to load an audio file, get its buffer's channels data & build up a reversed version, and then allow to mess with the playbackRate of both while "playing" ( actually connecting to the speakers as AudioContext.destination ) one of those alternatively.
    ( the above seems needed since we can't set the playbackRate.value to negative values .. ).

    The end goal being able to either change playback rate & direction as well as "seek" to specific parts of the buffer or it's reversed version.

    As far as I could check, the "seek()" fcn is available for elements, and the only way to do the same stuff with the Web Audio API is to create another buffer ( since we can't use "start(time)" more than once on a specific audio buffer ) for each "seeking action".

    Since we're talking about the Web Audio API, I started to digg the code used for Audio Jack Rx, to learn a little more about the "ScriptProcessor" & "onaudioprocess" stuff ( .. ) :)

    As I was wondering if it may be better to save a reversed audio file & then load both original & reversed in separate elements, I started diggin how to save audio files from stuff done using the web audio APi, and ended up to a link pointing to some PCM stuff :)
    -> I wonder if we can make use of that to be able to write a little tool that'd convert audio for proper playback from SD ( instead of overkill Audacity .. ) ?

    -> so, any experience on saving audio files / Web Audio API "seek" / above stuff anyone ? :D


    1 Attachment

    • usingSoftpot.png
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Scratchy - HDD discs hacked into pseudo-turntables to alter sound(s) playing through WebAudioAPI on a connected laptop

Posted by Avatar for stephaneAG @stephaneAG

Actions