logo elektroda
logo elektroda
X
logo elektroda

LooTunes - Automatic Music Player with Pyua PY32F002AF15P6TU, SBC Codec, MicroSD, Light Sensor

Tailsy 3717 37
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • #31 21758686
    jackfinch
    Level 18  
    Tailsy wrote:
    Programming is done via the SWD socket, and for programming and all development I used probably the cheapest possible programmer: a debugprobe based on the Raspberry Pi Pico. A clone of the board can be bought from a Chinese for as little as a dollar, and the original one is also very cheap.


    Hello
    Can you show what this clone debug probe looks like for programming these Puya microcontrollers?
    Greetings
  • ADVERTISEMENT
  • #32 21758814
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #33 21759233
    Tailsy
    Level 15  
    >>21758686
    jackfinch wrote:
    Can you show what this clone debug probe looks like for programming these Puya microcontrollers?

    I was thinking of a raspberry pi pico clone. You can upload the firmware from debugprobe to the pi pico (over USB), add 2 resistors (for swdio and swclk lines) and you have a programmer ready, with free uart support. My board is simply the original pi pico with two resistors in the spider and 3.3V and GND out. The resistors are actually needed, because I've already burned 2 pins on the pico 2 times when I remapped the swd pins to GPIO in the pi while debugging.
  • ADVERTISEMENT
  • #34 21759411
    jackfinch
    Level 18  
    Thanks for the explanation, about the heater I was looking for information on Ali, and here it turns out that everything about it can be found on us on the electrode: Link . One more question, because I may not have read it, how do you convert mp3 files to sbc format?

    Okey I already know, I overlooked that :

    You can convert files to SBC using FFmpeg, the command is:

    Code: [expand] [select all][Copy to clipboard]
    ffmpeg -n -i "file_input.mp3" -ac 2 -c:a sbc -b:a 328k "file_output.sbc"

    I have put a bash script on the repository that converts all mp3 and flac files from the "in" directory to the "out" directory:
    https://github.com/l0ud/LooTunes/blob/master/assets/convert.sh

    The main directory should contain the config.ini file and the state.bin file (if you want to store the current state). The .sbc files must be in subdirectories. If you do not want to divide the music into folders, you should create at least one folder anyway and place these files there."

    Regards
  • ADVERTISEMENT
  • #35 21759623
    acctr
    Level 39  
    Tailsy wrote:
    Although it will rather be a bit more than one line to calculate the correct coefficients for this function when changing the folder.

    This is not a big problem, as the coefficients can already be determined at the compilation stage.
    A function of the form f(x) = (a*x + b) mod N is differentiable when a and N are relatively prime. It is therefore sufficient to find the minimum prime number p greater than N/2.

    Wanting to fit the calculation in 32-bit variables we get a maximum number of files equal to 2^16 = 65536, N/2=32768.
    The smallest prime number greater than N/2 is pmin=32771. The largest prime number less than N/2 is pmax=32749.

    What remains is the choice of the parameter b, which can be equal to, for example, b=13.
    So we have the function f(x) = (32771*x + 13) mod N. For small values of N we get permutations:

    Code: Bash
    Log in, to see the code


    From these examples you can see that with each change of N the order of the elements changes, without any change in the parameters a and b.
    It can then be tested whether for each i from 1 to N the bijection is preserved. Using Dirichlet's principle, this can be tested with a function:

    Code: C / C++
    Log in, to see the code


    For the given parameters, it confirms that over the entire range from 1 to N each element occurs exactly once - each piece is played once and none is missed.
    It is then possible to check how the function behaves when a=pmax, i.e. when the relative precedence condition is not maintained f(x) = (32749*x + 13) mod N.
    The test shows that for N=32749 the function is not differentiable.

    The question of the representation of the numbering of the files in the directories remains, it may look like x=directory no*1000 + file no, inverse operations noDirectory=x/1000, file no=x mod 1000.

    khoam wrote:
    Function with "one-line" modulo operation does not guarantee permutation without repetition

    Where did you get this from?
    khoam wrote:
    The Feistel network is a legitimate choice for permutations without repetition in limited memory and does not require "manual" selection of this multiplier

    For that, it requires some magic numbers, the meaning of which you would not be able to give without the help of AI :D
    Helpful post? Buy me a coffee.
  • #36 21759722
    Anonymous
    Level 1  
  • #37 21759924
    Tailsy
    Level 15  
    khoam wrote:
    Now I'm convinced that the source code for this gadget is bastard vibe coding

    ??? Because someone in the topic posted the answer from the gpt hut?


    acctr wrote:
    So we have a function f(x) = (32771*x + 13) mod N. For small values of N we get permutations:

    N=5: 2 3 4 0 1
    N=6: 5 4 3 2 1 0
    N=7: 3 0 4 1 5 2 6
    N=8: 1 4 7 2 5 0 3 6
    N=9: 8 1 3 5 7 0 2 4 6
    N=10: 7 8 9 0 1 2 3 4 5 6


    Probably not quite:
    https://onlinegdb.com/72RS7DiOr

    N = 5
    3 4 0 1 2 
    N = 6
    1 0 5 4 3 2 
    N = 7
    6 3 0 4 1 5 2 
    N = 8
    5 0 3 6 1 4 7 2 
    N = 9
    4 6 8 1 3 5 7 0 2 
    N = 10
    3 4 5 6 7 8 9 0 1 2 


    But smaller, even with smaller collections I can see that the draw quality of the current code (+ the ability to base it on seed) suits me much better.
  • #38 21759935
    acctr
    Level 39  
    Tailsy wrote:
    I guess not really:
    https://onlinegdb.com/72RS7DiOr

    This is virtually the same thing, the difference is that you start the loop at 1, in my case I started at 0.
    You can see well the offset equal to 1 for N=5:

    Code: Bash
    Log in, to see the code


    Tailsy wrote:
    But smaller, even with smaller sets I can see that the draw quality of the current code (+ the ability to base it on seed) suits me much better.

    Feistel networks have different properties, and from what I remember changing N has less effect on the global permutation form, but I don't know what you mean by "draw quality", because there is no draw in the code (because there can't be), and seed is the same as the parameter b or a.
    Either way, it is completely irrelevant in the use of the player, because with such a quantity even songs played in sequence will give the impression of being "random".
    Helpful post? Buy me a coffee.
📢 Listen (AI):
ADVERTISEMENT