Re: how to play bytebeat on openbsd?

2024-02-05 Thread beecdaddict
ah after bumping up the 8 I find it to be more-less the same as with sox!
thank you I think the problem was -c has to be 0:0 :) and also -o came useful
I forgot how to read manual (I was looking for it in manual but I didn't know
what I was looking for)

I can delete sox now and have less program thanks!

On Mon, February 5, 2024 1:21 pm, Alexandre Ratchov wrote:
> On Fri, Feb 02, 2024 at 06:41:46PM -, beecdadd...@danwin1210.de wrote:
>
>> hello
>>
>> I've tried for hours to play bytebeat as everyone else
>>
>>
>> I cannot find anything on the entire internet
>>
>>
>> all I got is `cat a.out >> /dev/speaker)` as root.. a.out is compiled code
>> , a
>> loop and `putchar(t*((t>>12|t>>8)&63>>4));`.. this doesn't sound nearly
>> the same as it does to other people it's also slow, not fast
>>
>
> You've to compile the bytebeat program, run it and send the result to a
> program that will play can play usinged 8-bit mono at 8kHz.  aucat(1) can do
> this.
>
> Example, create a bytebeat.c file with your one-liner and the proper C
> boilerplate:
>
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>
> #include 
>
>
> int main(void) {
> int t;
>
> for (t = 0; t < 8; t++) { putchar(t*((t>>12|t>>8)&63>>4)); }
>
>
> return 0; }
>
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>
> Build it:
>
>
> cc -Wall bytebeat.c
>
> Play the result:
>
>
> ./a.out | aucat -e u8 -c 0:1 -r 8000 -i -
>
>
> Or save it a as music.wav so you can futher process it and/or send it to
> someone:
>
>
> ./a.out | aucat -e u8 -c 0:0 -r 8000 -i - -n -o music.wav
>
>
> HTH
>
>
>




Re: how to play bytebeat on openbsd?

2024-02-05 Thread Alexandre Ratchov
On Mon, Feb 05, 2024 at 02:21:17PM +0100, Alexandre Ratchov wrote:
> Play the result:
> 
> ./a.out | aucat -e u8 -c 0:1 -r 8000 -i -
^^^

should be "-c 0:0", but "-c 0:1" may also make sense for certain one-liners
;-)



Re: how to play bytebeat on openbsd?

2024-02-05 Thread Alexandre Ratchov
On Fri, Feb 02, 2024 at 06:41:46PM -, beecdadd...@danwin1210.de wrote:
> hello
> 
> I've tried for hours to play bytebeat as everyone else
> 
> I cannot find anything on the entire internet
> 
> all I got is `cat a.out >> /dev/speaker)` as root.. a.out is compiled code , a
> loop and `putchar(t*((t>>12|t>>8)&63>>4));`.. this doesn't sound nearly the
> same as it does to other people
> it's also slow, not fast
> 

You've to compile the bytebeat program, run it and send the result to a
program that will play can play usinged 8-bit mono at 8kHz.  aucat(1) can do
this.

Example, create a bytebeat.c file with your one-liner and the proper C
boilerplate:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

#include 

int main(void)
{
int t;

for (t = 0; t < 8; t++) {
putchar(t*((t>>12|t>>8)&63>>4));
}

return 0;
}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Build it:

cc -Wall bytebeat.c

Play the result:

./a.out | aucat -e u8 -c 0:1 -r 8000 -i -

Or save it a as music.wav so you can futher process it and/or send it to
someone:

./a.out | aucat -e u8 -c 0:0 -r 8000 -i - -n -o music.wav

HTH



Re: [answered]Re: how to play bytebeat on openbsd?

2024-02-04 Thread beecdaddict
that does work, then why doesn't this work?
./a.out | sox -r 8000 -c 1 -t u8 - -d
doesn't work
but if uint8_t is changed to int, it works well..
also in sox sounds sounds different compared to say mpv, cannot decide which
is better because I cannot seek forward in sox's play?

can you make music with sox/play alone? you can make guitar sounds with play,
maybe can also somehow write a whole song only in CLI?

#include 
#include 

int main (int argc, char **argv) {
  uint8_t t = 0;
  for (t=0;;t++)
putchar(t*((t>>12|t>>8)&63>>4));
}


On Sat, February 3, 2024 2:58 pm, Nick Owens wrote:
> try piping to
>
> sox -r 8000 -c 1 -t u8 - -d
>
> for example, this should work as a demo:
>
> python3 -c 'import sys; [sys.stdout.write(chr(( t & (t >> 8)) % 256)) for t in
> range(2**19)]' | sox -r 8000 -c 1 -t u8 - -d
>
>
> On Sat, Feb 3, 2024 at 6:20 AM  wrote:
>
>>
>> thank you, stranger!
>>
>> I found so many good C formulas, some sound like they could be used within
>> a game, even has pauses with silence and everything!
>>
>> I had to find out how to use sox, though on another site: `sox -r 8000 -c
>> -t
>> u8 test.raw output.wav`
>>
>> what is weird is that I can't get bytebeats if the `t` is int8_t or
>> something.. doesn't seem like that makes sense, it's like 4 bytes 32-bit,
>> not 1 byte.
>> not sure difference between signed 32, 64 and unsigned, but I tried 16-bit
>> `t`
>> and it's just not it.. am I messing something up?
>>
>> does this only mimic bytebeat, and is not true 8-bit technique to get
>> realistic bytebeat?
>>
>> On Fri, February 2, 2024 9:15 pm, Nick Owens wrote:
>>
>>> back when i used to mess with these, i frequently used `sox` to play the
>>> 8-bit
>>> samples. it can do the sample conversion for you to whatever the system
>>> needs.
>>>
>>>
>>> On Fri, Feb 2, 2024 at 11:08 AM Omar Polo  wrote:
>>>
>>>

 On 2024/02/02 18:41:46 +, beecdadd...@danwin1210.de wrote:


> hello
>
> I've tried for hours to play bytebeat as everyone else
>
>
>
> I cannot find anything on the entire internet
>
>
>
> all I got is `cat a.out >> /dev/speaker)` as root.. a.out is compiled
>  code , a loop and `putchar(t*((t>>12|t>>8)&63>>4));`.. this
> doesn't sound nearly the same as it does to other people it's also
> slow, not fast

 I don't think it makes sense to feed speaker(4) with an executable
 code.


 Haven't seen the code, but based on your description I guess it should
 be more like

 $ ./a.out | doas tee /dev/speaker



 or at least that's my guess, my crystall ball don't always works
 correctly.

>>>
>>>
>>
>>
>>
>
>





Re: [answered]Re: how to play bytebeat on openbsd?

2024-02-03 Thread Nick Owens
try piping to

  sox -r 8000 -c 1 -t u8 - -d

for example, this should work as a demo:

  python3 -c 'import sys; [sys.stdout.write(chr(( t & (t >> 8)) %
256)) for t in range(2**19)]' | sox -r 8000
-c 1 -t u8 - -d

On Sat, Feb 3, 2024 at 6:20 AM  wrote:
>
> thank you, stranger!
>
> I found so many good C formulas, some sound like they could be used within a
> game, even has pauses with silence and everything!
>
> I had to find out how to use sox, though on another site: `sox -r 8000 -c -t
> u8 test.raw output.wav`
>
> what is weird is that I can't get bytebeats if the `t` is int8_t or
> something.. doesn't seem like that makes sense, it's like 4 bytes 32-bit, not
> 1 byte.
> not sure difference between signed 32, 64 and unsigned, but I tried 16-bit `t`
> and it's just not it.. am I messing something up?
>
> does this only mimic bytebeat, and is not true 8-bit technique to get
> realistic bytebeat?
>
> On Fri, February 2, 2024 9:15 pm, Nick Owens wrote:
> > back when i used to mess with these, i frequently used `sox` to play the 
> > 8-bit
> > samples. it can do the sample conversion for you to whatever the system 
> > needs.
> >
> >
> > On Fri, Feb 2, 2024 at 11:08 AM Omar Polo  wrote:
> >
> >>
> >> On 2024/02/02 18:41:46 +, beecdadd...@danwin1210.de wrote:
> >>
> >>> hello
> >>>
> >>> I've tried for hours to play bytebeat as everyone else
> >>>
> >>>
> >>> I cannot find anything on the entire internet
> >>>
> >>>
> >>> all I got is `cat a.out >> /dev/speaker)` as root.. a.out is compiled
> >>> code , a loop and `putchar(t*((t>>12|t>>8)&63>>4));`.. this doesn't
> >>> sound nearly the same as it does to other people it's also slow, not fast
> >>
> >> I don't think it makes sense to feed speaker(4) with an executable code.
> >>
> >>
> >> Haven't seen the code, but based on your description I guess it should
> >> be more like
> >>
> >> $ ./a.out | doas tee /dev/speaker
> >>
> >>
> >> or at least that's my guess, my crystall ball don't always works correctly.
> >>
> >
> >
>
>
>



[answered]Re: how to play bytebeat on openbsd?

2024-02-03 Thread beecdaddict
thank you, stranger!

I found so many good C formulas, some sound like they could be used within a
game, even has pauses with silence and everything!

I had to find out how to use sox, though on another site: `sox -r 8000 -c -t
u8 test.raw output.wav`

what is weird is that I can't get bytebeats if the `t` is int8_t or
something.. doesn't seem like that makes sense, it's like 4 bytes 32-bit, not
1 byte.
not sure difference between signed 32, 64 and unsigned, but I tried 16-bit `t`
and it's just not it.. am I messing something up?

does this only mimic bytebeat, and is not true 8-bit technique to get
realistic bytebeat?

On Fri, February 2, 2024 9:15 pm, Nick Owens wrote:
> back when i used to mess with these, i frequently used `sox` to play the 8-bit
> samples. it can do the sample conversion for you to whatever the system needs.
>
>
> On Fri, Feb 2, 2024 at 11:08 AM Omar Polo  wrote:
>
>>
>> On 2024/02/02 18:41:46 +, beecdadd...@danwin1210.de wrote:
>>
>>> hello
>>>
>>> I've tried for hours to play bytebeat as everyone else
>>>
>>>
>>> I cannot find anything on the entire internet
>>>
>>>
>>> all I got is `cat a.out >> /dev/speaker)` as root.. a.out is compiled
>>> code , a loop and `putchar(t*((t>>12|t>>8)&63>>4));`.. this doesn't
>>> sound nearly the same as it does to other people it's also slow, not fast
>>
>> I don't think it makes sense to feed speaker(4) with an executable code.
>>
>>
>> Haven't seen the code, but based on your description I guess it should
>> be more like
>>
>> $ ./a.out | doas tee /dev/speaker
>>
>>
>> or at least that's my guess, my crystall ball don't always works correctly.
>>
>
>





Re: how to play bytebeat on openbsd?

2024-02-02 Thread Nick Owens
back when i used to mess with these, i frequently used `sox` to play
the 8-bit samples. it can do the sample conversion for you to whatever
the system needs.

On Fri, Feb 2, 2024 at 11:08 AM Omar Polo  wrote:
>
> On 2024/02/02 18:41:46 +, beecdadd...@danwin1210.de wrote:
> > hello
> >
> > I've tried for hours to play bytebeat as everyone else
> >
> > I cannot find anything on the entire internet
> >
> > all I got is `cat a.out >> /dev/speaker)` as root.. a.out is compiled code 
> > , a
> > loop and `putchar(t*((t>>12|t>>8)&63>>4));`.. this doesn't sound nearly 
> > the
> > same as it does to other people
> > it's also slow, not fast
>
> I don't think it makes sense to feed speaker(4) with an executable code.
>
> Haven't seen the code, but based on your description I guess it should
> be more like
>
> $ ./a.out | doas tee /dev/speaker
>
> or at least that's my guess, my crystall ball don't always works
> correctly.
>



Re: how to play bytebeat on openbsd?

2024-02-02 Thread Omar Polo
On 2024/02/02 18:41:46 +, beecdadd...@danwin1210.de wrote:
> hello
> 
> I've tried for hours to play bytebeat as everyone else
> 
> I cannot find anything on the entire internet
> 
> all I got is `cat a.out >> /dev/speaker)` as root.. a.out is compiled code , a
> loop and `putchar(t*((t>>12|t>>8)&63>>4));`.. this doesn't sound nearly the
> same as it does to other people
> it's also slow, not fast

I don't think it makes sense to feed speaker(4) with an executable code.

Haven't seen the code, but based on your description I guess it should
be more like

$ ./a.out | doas tee /dev/speaker

or at least that's my guess, my crystall ball don't always works
correctly.



Re: how to play bytebeat on openbsd?

2024-02-02 Thread beecdaddict
there is this video with some C code
https://youtube.com/watch?v=GtQdIYUtAHg
these are some examples

On Fri, February 2, 2024 6:41 pm, beecdadd...@danwin1210.de wrote:
> hello
>
> I've tried for hours to play bytebeat as everyone else
>
>
> I cannot find anything on the entire internet
>
>
> all I got is `cat a.out >> /dev/speaker)` as root.. a.out is compiled code ,
> a loop and `putchar(t*((t>>12|t>>8)&63>>4));`.. this doesn't sound nearly
> the same as it does to other people it's also slow, not fast
>
> man speaker doesn't help much aucat also doesn't seem to be for this
>
> do I need PCM? All videos I found people writting in C++, a bytebeat player
> was for Windows
>
> please help
>
>