It is currently Sat Jan 16, 2021 9:04 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: High quality command programming
PostPosted: Wed Feb 24, 2016 8:37 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jan 12, 2004 11:40 pm
Posts: 777
Location: Okazaki, JAPAN
Hello everyone. I made high quality sound player, It's Bug head! This source code have
many fantasy tips all. But just use You can high quality code, That's perfect tips!
have fun.

Code:
; High quality command programming
; Copyright 2016 (c) Hiroyuki Yokota (oryaaaaa)
;
; How to use this tips
; result is [Improved] Image quality, Sound quality
; Please set two macro before call procedure.
;
; <example>
; CreateFresh
; FNOPx10
; Maximum(nb1, nb2)
;
; ; <open window>
;
; CreateFresh
; FNOPx10
; OpenWindow(para_1, para_2,  para_3, para_4, para_5, para_6, para_7, para_8)
;
; ; <load dll>
;
; CreateFresh
; FNOPx10
; If Not OpenLibrary(16, "bass.dll")
;   MessageRequester("bass.dll error", "Don't load bass.dll")
;   End
; EndIf
;
; CreateFresh
; FNOPx10
; *BASS_Init = GetFunction(16, "BASS_Init")
;
; ; <Bass asio>
; ;
; CreateFresh
; FNOPx10
; If CallFunctionFast(*BASS_ASIO_Init, AsioSelectDevice, #BASS_ASIO_THREAD) And BASS_ASIO_CheckRate(Freq_d)
;   CreateFresh
;   FNOPx10
;   BASS_ASIO_SetRate(Freq_d)


Macro CreateFresh
  CompilerSelect #PB_Compiler_Processor
    CompilerCase #PB_Processor_x86
      !XOR Eax, Eax ; clear Eax
      !XOR Eax, Eax
      !MOV Eax, Esp
      !XOR Esp, Esp ; clear Esp
      !XOR Esp, Esp
      !BSWAP Esp ; (just another code is) Not Esp
      !BSWAP Esp ; (just another code is) Not Esp
      !MOV Esp, Eax
    CompilerCase #PB_Processor_x64
      !XOR Rcx, Rcx ; clear Rcx
      !XOR Rcx, Rcx
      !BSWAP Rcx ; (just another code is) Not Rcx
      !BSWAP Rcx ; (just another code is) Not Rcx
      !XOR Rdx, Rdx ; clear Rdx
      !XOR Rdx, Rdx
      !BSWAP Rdx ; (just another code is) Not Rdx
      !BSWAP Rdx ; (just another code is) Not Rdx
      !XOR R8, R8 ; clear R8
      !XOR R8, R8
      !BSWAP R8 ; (just another code is) Not R8
      !BSWAP R8 ; (just another code is) Not R8
      !XOR R9, R9 ; clear R9
      !XOR R9, R9
      !BSWAP R9 ; (just another code is) Not R9
      !BSWAP R9 ; (just another code is) Not R9
      !XOR Rax, Rax ; clear Rax
      !XOR Rax, Rax
      !MOV Rax, Rsp
      !XOR Rsp, Rsp ; clear Rsp
      !XOR Rsp, Rsp
      !BSWAP Rsp ; (just another code is) Not Rsp
      !BSWAP Rsp ; (just another code is) Not Rsp
      !MOV Rsp, Rax
  CompilerEndSelect
  !XCHG al, al
EndMacro

Macro FNOPx10
  CompilerSelect #PB_Compiler_Processor
    CompilerCase #PB_Processor_x86
      !BSWAP Eax ; (just another code is) Not Eax
      !BSWAP Eax ; (just another code is) Not Eax
    CompilerCase #PB_Processor_x64
      !BSWAP Rax ; (just another code is) Not Rax
      !BSWAP Rax ; (just another code is) Not Rax
  CompilerEndSelect
  !FNOP ; 1  register's cool times
  !FNOP
  !FNOP ; 3
  !FNOP
  !FNOP ; 5
  !FNOP
  !FNOP ; 7
  !FNOP
  !FNOP
  !FNOP ; 10
EndMacro

; This source code is from SoundPlugin.pb
; You can high quality sound output.

CreateFresh
FNOPx10
If Not InitSound()
  End
EndIf

CreateFresh
FNOPx10
UseFLACSoundDecoder()

CreateFresh
FNOPx10
SoundFileName$ = OpenFileRequester("Choose a sound file (44.1kHz only)", "", "Wave or Flac files|*.wav;*.flac",0)
If SoundFileName$
 
  CreateFresh
  FNOPx10
  If LoadSound(0, SoundFileName$)
   
    CreateFresh
    FNOPx10
    SoundVolume(0, 70)
   
    CreateFresh
    FNOPx10
    PlaySound(0,#PB_Sound_Loop)
   
    CreateFresh
    FNOPx10
    MessageRequester("Sound", "Playing the sound (loop)..."+Chr(10)+"Click to quit..", 0)
  Else
    MessageRequester("Error", "Can't load the sound.", 0)
  EndIf
EndIf
End


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Wed Feb 24, 2016 11:46 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 04, 2013 5:28 pm
Posts: 334
Could you give some background on why these sequences of instructions should result in higher audio quality and how ?
If you have problems explaining in english, maybe some link to some external resource ?
Because I don't really know what's the logic behind all this. :o


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Wed Feb 24, 2016 8:38 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jan 12, 2004 11:40 pm
Posts: 777
Location: Okazaki, JAPAN
DontTalkToMe wrote:
Could you give some background on why these sequences of instructions should result in higher audio quality and how ?
If you have problems explaining in english, maybe some link to some external resource ?
Because I don't really know what's the logic behind all this. :o


Becomes the story of electronics and electrical engineering, but in simple

have noise for sound player
pcm wave ... 0.1 0.8 0.2 0.9 0.0 1.0
Code:
; Not intialize Rcx ... 0.0 0.1 0.2 0.3 (have digital jitter)
!MOV Rcx, 400  ; (from loaded memory)
; RCX is memory based
!CALL ABCD


not have noise for sound player
pcm wave ... 0.1 0.9 0.1 0.9 0.1 0.9
Code:
; intialize Rcx ... 0.1 (not have digital jitter)
!XOR Rcx, Rcx
!MOV Rcx, 400 ; (from loaded memory)
; RCX is cpu process based
!CALL ABCD


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Thu Feb 25, 2016 4:49 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 04, 2015 7:10 am
Posts: 1672
hello i am confused by the double-use of the same instructions, for example you perform the same xor operation to clear a register, but do it twice... the second time you're just clearing an already-cleared register?
Code:
      !XOR Eax, Eax ; clear Eax
      !XOR Eax, Eax

_________________
Thankyou to all the coders who generously helped & encouraged me in the nearly 2yrs when i was welcome here,
it was a tremendous privilege. I learned a lot. I wish you and your families all the best and success for the future.


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Sat Feb 27, 2016 1:20 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jan 12, 2004 11:40 pm
Posts: 777
Location: Okazaki, JAPAN
This code is low jitter programming.
To understand the electronic circuit design, deep understanding is essential for the internal design of the CPU.

Code:
XOR Eax, Eax .... average sound  (class : iTunes)

XOR Eax, Eax
XOR Eax, Eax .... better sound (class : foobar2000)

XOR Eax, Eax
XOR Eax, Eax
AND Eax, Eax
OR Eax, Eax
OR Eax, Eax
XOR Eax, Eax .... best sound (class : Bug head, JPLAY)


New my sound thread code, Initialize stack pointer
Code:
 ; StackPointerFresh
  ; Copyright (c) Hiroyuki Yokota (oryaaaaa)
  Macro StackPointerFresh
    CompilerSelect #PB_Compiler_Processor
      CompilerCase #PB_Processor_x86
        !XOR Eax, Eax
        !XOR Eax, Eax
        !NOT Esp
        !MOV Eax, Esp
        !NOT Esp
        !MOV Eax, Esp
        !XOR Esp, Esp
        !XOR Esp, Esp
        !BSWAP Esp
        !BSWAP Esp
        !NOT Eax
        !MOV Esp, Eax
        !NOT Eax
        !MOV Esp, Eax
      CompilerCase #PB_Processor_x64
        !XOR Rax, Rax
        !XOR Rax, Rax
        !NOT Rsp
        !MOV Rax, Rsp
        !NOT Rsp
        !MOV Rax, Rsp
        !XOR Rsp, Rsp
        !XOR Rsp, Rsp
        !BSWAP Rsp
        !BSWAP Rsp
        !NOT Rax
        !MOV Rsp, Rax
        !NOT Rax
        !MOV Rsp, Rax
    CompilerEndSelect
  EndMacro


Example
Code:
; 1st Line
StackPointerFresh
; Main code
OpenWindows(......)


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Sat Feb 27, 2016 3:57 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 04, 2015 7:10 am
Posts: 1672
oryaaaaa wrote:
This code is low jitter programming.
To understand the electronic circuit design, deep understanding is essential for the internal design of the CPU.
Code:
XOR Eax, Eax .... average sound  (class : iTunes)
XOR Eax, Eax
XOR Eax, Eax .... better sound (class : foobar2000)

please forgive my electronics newbieness :) - I understand that jitter is "the deviation from true periodicity of a presumed periodic signal in electronics and telecommunications, often in relation to a reference clock source. Jitter may be observed in characteristics such as the frequency of successive pulses, the signal amplitude, or phase of periodic signals", but I don't understand how your sample works in relation to that... in other words, how can one 0 be "average sound", then XOR'ing twice again makes it beter (zero 'becoming' zero 'becoming' zero again, ie always staying zero)? How does "zeroing zero" using the xor eax,eax when its already zero (effectively a "nothing command") improve audio quality, and how (if at all) does NOP compare? or is it an alignment thing? thanks

_________________
Thankyou to all the coders who generously helped & encouraged me in the nearly 2yrs when i was welcome here,
it was a tremendous privilege. I learned a lot. I wish you and your families all the best and success for the future.


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Sat Feb 27, 2016 10:40 am 
Offline
Always Here
Always Here

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 5201
Location: Germany
If it ios a 'jitter' thing, than it depends on the clock speed of the cpu.
But this is not respected in the code.
Maybe it has a better quality on a specific PC, maybe not on an other.

Bernd


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Sat Feb 27, 2016 11:56 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2994
Location: Planet Earth
To be honest, I never understood anything oryaaaaa was talking about.
But I don't have a 'deep understanding of electronic circuits' - a requirement to things he is talking about.

From a software programmer's point-of-view, even with low-level assembly language knowledge,
it just looks like something may be wrong with his sound routines. It never made any sense to me.

If a function is taking any register like EAX/RAX into account - regardless if it may be uninitialized,
it's just wrong code. Something is probably wrong with the function.
XOR'ing (clearing) RAX twice doesn't make any sense to me, too.

Maybe it's time for the solution to the puzzle. Of course there is always a chance someone comes up with a new idea,
and Hiroyuki Yokota may be the next Nobel Price winner.

You just have to prove the concept/idea to other people, so they are able to understand the revolution/secret.

Either he is genius or crazy - I don't know.


Last edited by Danilo on Sat Feb 27, 2016 11:32 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Sat Feb 27, 2016 12:29 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1907
Danilo wrote:
Either he is genius or crazy

Read his website (http://oryaaaaa.world.coocan.jp/bughead/index.html) to learn more about him.


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command (or Jitter, Explained in English)
PostPosted: Sun Apr 03, 2016 12:47 am 
Offline
User
User

Joined: Sun Apr 03, 2016 12:03 am
Posts: 61
He's not crazy. At least, not because of this code sample.
But you REALLY need to visit his website to make up your mind about him.
Don't download anything, though. Just saying. :)

He's just working at the very limits of his english language comprehension - and possibly at the limits of his own knowledge.

He's using the word jitter to describe subtle time shifts in handing sampling operations.
This is fairly important in radio signal processing, or for high precision audio processing for scientific purposes.
The extra instructions that look wrong on the surface are in fact quite correct for this application. He's counting cycles.
This is his way of ensuring that the same number of instruction cycles pass between captures.

In theory, this can eliminate errors that happen because you're not measuring at precisely the same interval each time.
Is jitter really that important in windows audio sampling? Maybe if you're doing something you need to do serious math upon.
Examples would be fourier transforms (useful for speech recognition) or trying to calculate where the other gunman was located... or maybe if you're playing with sonar, radio astronomy or audio fingerprints. Or maybe he just wants his recordings to be perfect.

I haven't looked carefully at the code, but the concept is a good one. However, doing this on a program running under windows probably negates some (if not most) of the benefit.
The technique is more suited to embedded programming. It's possible that he has resolved some of the drawbacks, but again, only the people who really need this could know why low jitter is important.

99.9% of the people on the board won't possibly see the use of this... but like the blind men and the elephant, there will always be something you haven't stuck a finger in yet. :)
(i'm going to also post this in the assembly language part)


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command (or Jitter, Explained in English)
PostPosted: Sun Apr 03, 2016 3:42 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2994
Location: Planet Earth
Bo Marchais wrote:
He's counting cycles. This is his way of ensuring that the same number of instruction cycles pass between captures.

That's what we did on C64, but does it make sense when everybody
has a different processor generation and speed?

His comments say he is clearing registers 2 or 3 times, because 1 time is not enough.
Like HDDs, where specialists can read old content, even after it's overwritten.

oryaaaaa wrote:
Code:
XOR Eax, Eax .... average sound  (class : iTunes)

XOR Eax, Eax
XOR Eax, Eax .... better sound (class : foobar2000)

XOR Eax, Eax
XOR Eax, Eax
AND Eax, Eax
OR Eax, Eax
OR Eax, Eax
XOR Eax, Eax .... best sound (class : Bug head, JPLAY)

Clear EAX 1 time = iTunes quality
Clear EAX 2 times = foobar2000
Clear EAX 6 times = best sound

:?:

Is this the same effect as with HDDs? Clearing more often makes sure it's really cleared?
(See here and Data remanence and Data remanence: Data in RAM)

Maybe he is considering Quantum mechanics effects in electronic circuits and CPU registers.


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command (or Jitter, Explained in English)
PostPosted: Sun Apr 03, 2016 3:56 pm 
Offline
User
User

Joined: Sun Apr 03, 2016 12:03 am
Posts: 61
Well...

>His comments say he is clearing registers 2 or 3 times, because 1 time is not enough.
>Like HDDs, where specialists can read old content, even after it's overwritten.

It's possible.
To me, such attempts to "preload" the cpu core are probably wasted. I've seen this kind of thing in DSP (digital signal processing) and acquisition when it is possible to influence (and sometimes improve) the average response and accuracy of a chip. If clearing the chip six times improves the next operation better than doing it once, sure. Perhaps his code has a side effect that seems to improve the sound quality.

But to some extent (unless we reverse engineering the code) it is like asking if a marathon runner is faster from eating spaghetti hot or from eating it cold - the only way to know is to test using outside equipment, and even then the answer is not certain. Audio signal processing is very subjective.

oryaaaaa wrote:
Code:
XOR Eax, Eax .... average sound  (class : iTunes)

XOR Eax, Eax
XOR Eax, Eax .... better sound (class : foobar2000)

XOR Eax, Eax
XOR Eax, Eax
AND Eax, Eax
OR Eax, Eax
OR Eax, Eax
XOR Eax, Eax .... best sound (class : Bug head, JPLAY)

Clear EAX 1 time = iTunes quality
Clear EAX 2 times = foobar2000
Clear EAX 6 times = best sound

:?:

I can't see why clearing the Eax register 6 times is any better than 1 time... and that's even though I believe that all chips, including multiple CPUs are essentially analog in nature.
If he's not doing it for timing purposes, then either a) doing it six times influences something else or b) he's read about this stuff and is trying to inject a little marketing magic into his application.

I guess I'll study his code a little. My only point is that sometimes doing odd things in your code path can produce useful and non-obvious effects - and I have seen it done!
For example, certain inexpensive data acquisition chips can outperform parts costing 10x as much if you simply feed them the wrong commands on purpose before taking a sample.

And everyone has seen how people accomplished great things by coding outside the box to make demos or use hardware in ways the designers never intended.

Quantum effects? I doubt it. I'll raise you the stakes and suggest that he's secretly mining bitcoins.
There's such a fine line between genius and crackpot these days. :)


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Sun Apr 03, 2016 4:32 pm 
Offline
User
User

Joined: Sun Apr 03, 2016 12:03 am
Posts: 61
http://oryaaaaa.world.coocan.jp/bughead/

Well... I guess that settles it. :)

I think he's probably a complicated guy, and has been teaching himself assembly language. His english is pretty good.
It turns out he's a writer, and all writers are crazy. I've been watching his posts for a while.

I think he had some local fame 10 years ago for a program he wrote, and would like to build upon that or be the author of a popular software package.
Looking through the submitted source code, I see he is actually using PB flac playback routines to do all the heavy lifting.
Initializing Eax registers won't do much for that. He's got some good ideas - it's just that he's still learning.

Who knows? A little vitamin D3 every day and regular exercise would help most programmers, and oryaaaa is no exception.
His current sources have a certain amount of cargo-cult engineering, but he's writing assembly code and contributing examples to the forum, and that's both A-OK and entertaining!
Guys like this help us all learn in one way or another... so I hope he'll keep working.


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Mon Apr 04, 2016 12:51 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Jul 03, 2004 9:04 am
Posts: 215
Location: Sydney Australia
Quote:
Who knows? A little vitamin D3 every day and regular exercise would help most programmers, and oryaaaa is no exception.
His current sources have a certain amount of cargo-cult engineering, but he's writing assembly code and contributing examples to the forum, and that's both A-OK and entertaining!
Guys like this help us all learn in one way or another... so I hope he'll keep working.


Well said .... :)


Top
 Profile  
Reply with quote  
 Post subject: Re: High quality command programming
PostPosted: Mon Apr 04, 2016 2:38 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 2994
Location: Planet Earth
Bo Marchais wrote:
Guys like this help us all learn in one way or another... so I hope he'll keep working.

I’ve seen that several times in the PB forums over the last 16 years:
One guy gives a wrong ‚tip‘ (or somebody didn’t understand correctly), and few month later everybody is spreading it - because they learned from the 1st guy.

I’m 100% for free learning, and sharing knowledge. In this topic, however, several people have asked for a deeper explanation
because its not obvious what it is for - at least without explaining it further.
Most of the time it’s clear why something works and is good to use. If not, we ask. :)

That’s nothing against oryaaaaa. Explaining it more detailed would help, not just saying "deep understanding is essential“.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 35 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye