anonymous No title
No License Java
2020年09月20日
Copy Clone
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.*;
import javax.swing.event.*;
import javax.sound.sampled.*;

public class SynthAkira extends JFrame implements ChangeListener{

  JSlider slider1;
  JSlider slider2;
  JPanel p1;
  JPanel p2;
  JButton b;
  JLabel label1;
  JLabel label2;

  public static void main(String[] args){
    SynthAkira frame = new SynthAkira();

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(10, 10, 600, 200);
    frame.setTitle("SYNTH AKIRA");
    frame.setVisible(true);
  }

  SynthAkira(){

    slider1 = new JSlider(0, 1000);
    slider1.setValue(100);
    slider1.addChangeListener(this);
    slider2 = new JSlider(0, 1000);
    slider2.setValue(100);
    slider2.addChangeListener(this);

    p1 = new JPanel();
    p1.add(slider1);
    p1.add(slider2);

    b = new JButton("PUSH");

    label1 = new JLabel();
    label2 = new JLabel();
    label1.setText("値:" + slider1.getValue());
    label2.setText("値:" + slider2.getValue());

    p2 = new JPanel();
    p2.add(label1);
    p2.add(label2);

    getContentPane().add(p1, BorderLayout.PAGE_START);
    getContentPane().add(b, BorderLayout.CENTER);
    getContentPane().add(p2, BorderLayout.PAGE_END);
    
    b.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
      			setSound();
		  }
		});
	}

   void setSound(){
      try{
         byte[] wave_data= new byte[44100*2];
         double l1      = 44100.0/slider1.getValue();
         double l2      = 44100.0/slider2.getValue();
         for(int i=0;i<wave_data.length;i++){
            wave_data[i]= (byte)(110*Math.sin((i/l1)*Math.PI*2
            +110*Math.sin((i/l2)*Math.PI*2)));
            }
         AudioFormat   frmt= new AudioFormat(44100,8,1,true,false);
         DataLine.Info info= new DataLine.Info(Clip.class,frmt);
         Clip          clip= (Clip)AudioSystem.getLine(info);
         clip.open(frmt,wave_data,0,wave_data.length);
         clip.start();

         Thread.sleep(100);while(clip.isRunning()) {Thread.sleep(100);}
         }
      catch(Exception e){e.printStackTrace(System.err);}
      }

	public void stateChanged(ChangeEvent e) {
    label1.setText("値:" + slider1.getValue());
    label2.setText("値:" + slider2.getValue());
 }
}
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.*;
import javax.swing.event.*;
import javax.sound.sampled.*;

public class SynthAkira extends JFrame implements ChangeListener{

  JSlider slider1;
  JSlider slider2;
  JPanel p1;
  JPanel p2;
  JButton b;
  JLabel label1;
  JLabel label2;

  public static void main(String[] args){
    SynthAkira frame = new SynthAkira();

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(10, 10, 600, 200);
    frame.setTitle("SYNTH AKIRA");
    frame.setVisible(true);
  }

  SynthAkira(){

    slider1 = new JSlider(0, 1000);
    slider1.setValue(100);
    slider1.addChangeListener(this);
    slider2 = new JSlider(0, 1000);
    slider2.setValue(100);
    slider2.addChangeListener(this);

    p1 = new JPanel();
    p1.add(slider1);
    p1.add(slider2);

    b = new JButton("PUSH");

    label1 = new JLabel();
    label2 = new JLabel();
    label1.setText("値:" + slider1.getValue());
    label2.setText("値:" + slider2.getValue());

    p2 = new JPanel();
    p2.add(label1);
    p2.add(label2);

    getContentPane().add(p1, BorderLayout.PAGE_START);
    getContentPane().add(b, BorderLayout.CENTER);
    getContentPane().add(p2, BorderLayout.PAGE_END);
    
    b.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
      			setSound();
		  }
		});
	}

   void setSound(){
      try{
         byte[] wave_data= new byte[44100*2];
         double l1      = 44100.0/slider1.getValue();
         double l2      = 44100.0/slider2.getValue();
         for(int i=0;i<wave_data.length;i++){
            wave_data[i]= (byte)(110*Math.sin((i/l1)*Math.PI*2
            +110*Math.sin((i/l2)*Math.PI*2)));
            }
         AudioFormat   frmt= new AudioFormat(44100,8,1,true,false);
         DataLine.Info info= new DataLine.Info(Clip.class,frmt);
         Clip          clip= (Clip)AudioSystem.getLine(info);
         clip.open(frmt,wave_data,0,wave_data.length);
         clip.start();

         Thread.sleep(100);while(clip.isRunning()) {Thread.sleep(100);}
         }
      catch(Exception e){e.printStackTrace(System.err);}
      }

	public void stateChanged(ChangeEvent e) {
    label1.setText("値:" + slider1.getValue());
    label2.setText("値:" + slider2.getValue());
 }
}
anonymous
Anonymous
2021年04月26日
Drugs prescribing information. Long-Term Effects. <a href="https://pregabalinfor.top">lyrica medication online</a> in USA Everything trends of drug. Get information now.
anonymous
Anonymous
2021年04月27日
Drug information sheet. Effects of Drug Abuse. <a href="https://lyrica24x7.top">order generic lyrica without insurance</a> in USA Actual about medicament. Get here.
anonymous
Anonymous
2021年04月30日
cialis walmart <a href="https://mycialistabs.com/">tadalafil generic usa</a> buy cialis cheap
anonymous
Anonymous
2021年04月30日
cialis uses <a href="https://mycialistabs.com/">tadalafil over the counter</a> what does a cialis pill look like
anonymous
Anonymous
2021年05月02日
cheap cialis <a href="https://toptadalafiltabs.com/">cialis lilly</a> cialis sample
anonymous
Anonymous
2021年05月03日
how much is cialis <a href="https://toptadalafiltabs.com/">what is the difference between viagra and cialis</a> cialis vs. viagra
anonymous
Anonymous
2021年05月04日
how to write an admissions essay <a href="https://topessaywriterfas.com/">college admissions essay</a> how do i write a college essay
anonymous
Anonymous
2021年05月05日
learning to read and write by frederick douglass essay <a href="https://topessaywriterfas.com/">college athletes should be paid essay</a> how to write an essay on an
anonymous
Anonymous
2021年05月06日
social service essay in tamil <a href="http://writemyessayslfd.com/">website that write essays for you</a> service delivery protest essay
anonymous
Anonymous
2021年05月06日
essay riter service <a href="http://writemyessayslfd.com/">writing an argument essay</a> concluding essay writing service
anonymous
Anonymous
2021年05月07日
buy viagra cheaply <a href="https://mrviagrashop.com">sildenafil without prescription</a> buy generic viagra
anonymous
Anonymous
2021年05月07日
viagra generic <a href="https://mrviagrashop.com">sildenafil</a> womens viagra
anonymous
Anonymous
2021年05月07日
natural viagra for men <a href="https://mysildenafilkr.com/">viagra from canada</a> best over the counter viagra
anonymous
Anonymous
2021年05月07日
viagra over the counter <a href="https://mysildenafilkr.com/">viagra memes</a> generic viagra cost
anonymous
Anonymous
2021年05月11日
cialis 20mg <a href="http://tadalafilled.com/">cialis from canada to usa</a> buy cialis without prescription
anonymous
Anonymous
2021年05月11日
technical resume <a href="http://coverletterforresumetop.com/">review my resume</a> making a cover letter
anonymous
Anonymous
2021年05月12日
graduate school resume <a href="http://coverletterforresumetop.com/">entry level resume</a> preschool teacher resume
anonymous
Anonymous
2021年05月12日
were can i buy cialis <a href="http://tadalafilled.com/">what is cialis used for</a> cialis patent expiration 2016
anonymous
Anonymous
2021年05月12日
resume ideas <a href="https://writingacoverletteronline.com/">professional resume editing</a> resume for teens
anonymous
Anonymous
2021年05月13日
short cover letter <a href="https://writingacoverletteronline.com/">certified resume writer</a> myperfect resume
anonymous
Anonymous
2021年05月13日
chinese herb viagra <a href="https://edviagramaster.net/">ingrediants in viagra</a> viagra for sale
anonymous
Anonymous
2021年05月14日
price of viagra <a href="https://edviagramaster.net/">buying viagra online</a> viagra pill
anonymous
Anonymous
2021年05月15日
women viagra pills <a href="https://sildenafilviagratop.com">buy real viagra online</a> natural sildenafil citrate
anonymous
Anonymous
2021年05月15日
substitute for viagra <a href="https://sildenafilviagratop.com">sildenafil citrate for sale</a> viagra street price
anonymous
Anonymous
2021年05月15日
cialis sample <a href="https://cialisortadalafil.com/">viagra and cialis</a> cialis 5mg side effects
anonymous
Anonymous
2021年05月15日
is 20mg cialis equal to 100mg viagra <a href="https://cialisortadalafil.com/">buy cialis canadian</a> cialis commercial bathtub
anonymous
Anonymous
2021年05月16日
cialis strength <a href="https://topcialistabs.com/">where to buy cialis</a> cialis cheapest price
anonymous
Anonymous
2021年05月17日
cialis efectos secundarios <a href="https://topcialistabs.com/">cialis effects</a> 20 mg cialis
anonymous
Anonymous
2021年05月18日
Medicine information for patients. What side effects? <a href="https://colchicine4u.top">colchicine price</a> in USA All about pills. Read information here.
anonymous
Anonymous
2021年05月21日
<a href="https://5bz.ru/">база предприятий россии 2020</a>
anonymous
Anonymous
2021年07月19日
<a href="https://krasota4u.ru">buy trazodone without rx</a>
anonymous
Anonymous
2021年07月25日
Drugs information leaflet. What side effects? <a href="https://plaquenil4people.top">generic plaquenil prices</a> in Canada All news about pills. Get here.