Fortraneries/SoundBrotching/panoramix.f90

38 lines
814 B
Fortran
Raw Normal View History

2023-01-04 18:16:01 +01:00
!-
! JUST A SMALL EXPERIMENT
!-
2022-02-07 23:17:22 +01:00
program panoramix
2022-03-31 22:14:11 +02:00
use soundbrotch
! ------------------------------------------------------
2022-02-07 23:17:22 +01:00
implicit none
2022-03-31 22:14:11 +02:00
integer :: left, right
integer :: errcode
integer :: nblus
real :: value, phi, ka
2022-02-07 23:17:22 +01:00
2022-05-05 06:58:45 +02:00
write(0, *) "*** Panoramix ***"
2022-03-31 22:14:11 +02:00
call soundbrotch_version()
nblus = 0
do
read (*, *, iostat=errcode) left, right
if (errcode .NE. 0) then
2022-05-05 06:58:45 +02:00
! write(0, *) 'EOF ? ', errcode
2022-03-31 22:14:11 +02:00
exit
endif
2023-01-04 18:16:01 +01:00
phi = real(nblus) / 9500.0
ka = 0.500 + (sin(phi) * 0.4999)
2022-03-31 22:14:11 +02:00
value = (real(left)+real(right)) / 2.05
2022-05-23 11:11:09 +02:00
left = int(value * ka)
right = int(value * (1.0-ka))
2022-03-31 22:14:11 +02:00
print *, left, right
nblus = nblus + 1
enddo
2022-02-07 23:17:22 +01:00
end program